0 to n
, where n is a constant integer, then the variable can be representated as a bit-field
whose width is the integral part of(the log in the answers are to the base 2)printf("%d", 10?0?5:11:12);
prints __________?printf("%d", sizeof(""));
prints __________?p
is a pointer to an integer and t
is a pointer to a character then sizeof(p)
will be?
char street[10] = "abcdefghi";
int d = 0;
int i, j, k;
for(i=1; i < 31; ++i)
for(j=1; j < 31; ++j)
for(k=1; k < 31; ++k)
if(((i+j+k)%3) == 0)
d = d+1;
printf("%d", d);
f(5)
?int f(int n)
{
static int r=0;
if(n <= 0)
return 1;
if(n > 3)
{
r = n;
return f(n-2) +2;
}
return f(n-1) + r;
}
x, y, z
makes the variable a
get the value 4 in the following expression?a = (x>y) ? ((x>z) ? x:z) : ((y>z) ? y:z)
#include<stdio.h>
int f(nt *a, int n)
{
if(n <= 0)
return 0;
else if(*a%2 == 0)
return *a + f(a+1, n+1);
else
return *a - f(a+1, n-1);
}
int main()
{
int a[] = {12, 7, 13, 4, 11, 6};
printf("%d", f(a,6));
return 0;
}
char c[] = "GATE2017";
char *p = c;
printf("%s", p + p[3] - p[1]);
#include<stdio.h>
void f(int *p, int *q)
{
p = q;
*p = 2;
}
int i = 0, j = 1;
int main()
{
f(&i, &j);
printf("%d %d\n", i, j);
return 0;
}
CellNode
represents a node in a binary tree. The value returned by GetValue
when a pointer to the root of a binary tree
is passed as its argument is?struct CellNode
{
struct CellNode *leftChild;
int element;
struct CellNode *rightChild;
};
int GetValue(struct CellNode *ptr)
{
int value=0;
if(ptr !=NULL)
{
if((ptr->leftChild == NULL) && (ptr->rightChild == NULL))
{
value=1;
}
else
{
value = value + GetValue(ptr->leftChild) + GetValue(ptr->rightChild);
}
return (value);
}
n > 0
is?int j, n;
j = 1;
while(j <= n)
{
j = j*2;
}
printf("%d", (a++));
prints?Having second thoughts for any code related question?
Try executing the code in our Code Playground