Declare 2 pointer variable of the same type and assign the address of the variable to them and then increment one of them.
Find the difference between the above 2 pointers using a type cast. This will be the size of the variable.
Eg:
double i;
double * p = &i;
double * q= p;
p++;
cout<<(int)p-(int)q<<endl;
Yes. The array name is a reference to the array, so you can use sizeof (name) / sizeof (name[0]) to determine the number of elements. Note that sizeof (name) alone gives the length of the array in bytes.
Compare the first two numbers with the ternary operator. Store the result in a temporary variable. Compare the temporary variable with the third number, again using the ternary operator.
printf ("sizeof (int) = %d\n", (int)sizeof (int));
There is no such increment operator in C language to increment the value of a variable by 2.An increment operator only increments the value by 1. however you can apply the increment operator twice to get an increment of 3. No: you cannot: ++(++a) won't compile. Yes. Example: a += 2; but += is not an increment operator, it's a shorthand of a=a+2; just like a++ is a shorthand for a= a+1
a ^= b; b ^= a; a ^= b;
Pointer is a variable that stores the address of another variable . So pointer basically stores the address of another variable and size of pointer can be evaluated by using sizeof operator.
Yes. The array name is a reference to the array, so you can use sizeof (name) / sizeof (name[0]) to determine the number of elements. Note that sizeof (name) alone gives the length of the array in bytes.
Compare the first two numbers with the ternary operator. Store the result in a temporary variable. Compare the temporary variable with the third number, again using the ternary operator.
using pow() function.. ..
printf ("sizeof (int) = %d\n", (int)sizeof (int));
There is no such increment operator in C language to increment the value of a variable by 2.An increment operator only increments the value by 1. however you can apply the increment operator twice to get an increment of 3. No: you cannot: ++(++a) won't compile. Yes. Example: a += 2; but += is not an increment operator, it's a shorthand of a=a+2; just like a++ is a shorthand for a= a+1
a ^= b; b ^= a; a ^= b;
With repeated multiplication.
No. In COBOL, any variable must be declared with PIC statement.
By dereferencing the pointer variable. This can be achieved in two ways: typedef struct s { int i; float f; }; void f (struct s* p) { int x = p->i; /* using pointer to member operator */ float y = (*p).f; /* using dereference operator */ } The two methods are functionally equivalent.
Nothing. Never do that.
#include <stdlib.h> int **array1 = malloc(nrows * sizeof(int *)); for(i = 0; i < nrows; i++) array1[i] = malloc(ncolumns * sizeof(int));