How can we change the name of a column of a table?
Dec 9th
MySQL query to rename table: RENAME TABLE tbl_name TO new_tbl_name
[, tbl_name2 TO new_tbl_name2] …
Explain the variable assignment in the declaration
Dec 9th
int *(*p[10])(char *, char *);
It is an array of function pointers that returns an integer pointer. Each function has two arguments which in turn are pointers to character type variable. p[0], p[1],….., p[9] are function pointers.
return type : integer pointer.
p[10] : array of function pointers
char * : arguments passed to the function
Program: Example program to explain function pointers.
#include <stdio.h>
#include <stdlib.h>
int *(*p[10])(char *, char *);
//average function which returns pointer to
How is static variable stored in the memory?
Dec 9th
C++ uses name mangling when storing both local and global static varibales at the same place. The local static variables have function name and the global variables will have file name. Essentially the compiler uses namespace to distinguish between local and global static variables.
Can main() be overridden ?
Dec 9th
In any application, there can be only one main function. In c++, main is not a member of any class. There is no chance of overriding
What is the difference between macro and inline()?
Dec 9th
1. Inline follows strict parameter type checking, macros do not. 2. Macros are always expanded by preprocessor, whereas compiler may or may not replace the inline definitions.
What is memory leaking in c++ ?
Dec 9th
When a class uses dynamically allocated memory internally, all sorts of problems arise. If not properly used or handled, they can lead to memory leaks & corrupts Data Structures. A memory leak is the situation that occurs when dynamically allocated memory is lost to the program. Char * p;
p= new char[10000];
…..
p= new char[5000];
Initially, 10000 bytes are dynamically allocated & the the address of those bytes is stored in p. later 5000 bytes are dynamically allocated & the address is stored in p. However, the original 10000 bytes’ve not been returned to the system using delete [] operator. Memory leak actually More >
What is importance of const. pointer in copy constructor?
Dec 9th
Because otherwise you will pass the object to copy as an argument of copy constructor as pass by value which by definition creates a copy and so on… an infinite call chain
Why can’t we overload the sizeof, :?, :: ., .* operators in c++
Dec 9th
The restriction is for safety. For example if we overload. Operator then we can’t access member in normal way for that we have to use ->.
Is there any way to write a class such that no class can be inherited from it. Please include code
Dec 9th
Simple, make all constructors of the class private.
What is virtual class and friend class?
Dec 9th
Friend classes are used when two or more classes are designed to work together and virtual base class aids in multiple inheritance.
