main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}
- abc
- 77
- 68
- error
main()
{
char *p;
p="Hello";
printf("%c\n",*&*p);
}
- H
- e
- i
- error
main()
{
static char names[5][20]={"pascal","c","c++","java","python"};
int i;
char *t;
t=names[3];
names[3]=names[4];
names[4]=t;
for (i=0;i<=4;i++)
printf("%s",names[i]);
}
- Error
- pascal c c++ java python
- Pascal c c++
- none
int main()
{
int i;
char a[]="\0";
if(printf("%s\n",a))
printf("Ok here \n");
else
printf("Forget it\n");
}
- Forget it
- ok here
- error
- none
int aaa() { printf(“Hi”); }
int bbb() { printf(“hello”); }
iny ccc() { printf(“bye”); }
main()
{
int ( * ptr[3]) ();
ptr[0] = aaa;
ptr[1] = bbb;
ptr[2] =ccc;
ptr[2]();
}
- hi
- hello
- bye
- error
main()
{
char str1[] = {‘s’,’o’,’m’,’e’};
char str2[] = {‘s’,’o’,’m’,’e’,’\0’};
while (strcmp(str1,str2))
printf(“Strings are not equal\n”);
}
- string are not equal
- no output
- strings are not equal
- error
main()
{
char * str = "hello";
char * ptr = str;
char least = 127;
while (*ptr++)
least = (*ptr<least ) ?*ptr :least;
printf("%d",least);
}
- 127
- 0
- 1
- error
main()
{
for(putchar('c');putchar('a');putchar('r'))
putchar('t');
}
- syntax error
- cartrt
- catrat
- catratratrat
main()
{
int a=10;
int *ptr=&a;
printf("%d %d ",*ptr++,++*ptr);
}
- 11
- 10
- 11
- error
main()
{
int i=10;
int m=i+NULL;
printf("%d “,m);
}
- 0
- 10
- 11
- error
char *gabc()
{
static char abc[1024];
return abc;
}
main()
{
char *g="string";
strcpy(gabc(),g);
g = gabc();
strcpy(g,"oldstring");
printf("The string is : %s",gabc());
}
- ) The string is : string
- The string is :Oldstring
- Run time error/Core dump
- Syntax error during compilation