Strings

Q1:
Will the program compile successfully?
#include<stdio.h>

int main()
{
    char a[] = 'India';
    char *p = 'Aptitude';
    a = 'Aptitude';
    p = 'India';
    printf('%s %s\n', a, p);
    return 0;
}

A Yes

B No

ANS:A - Yes

Because we can assign a new string to a pointer but not to an array a.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.