Strings

Q1: What will be the output of the program ?
#include<stdio.h>

int main()
{
    char str = "AptitudeCrack";
    printf("%s\n", str);
    return 0;
}

A Error

B AptitudeCrack

C Base address of str

D No output

ANS:A - Error

The line char str = "AptitudeCrack"; generates "Non portable pointer conversion" error. To eliminate the error, we have to change the above line to char *str = "AptitudeCrack"; (or) char str[] = "AptitudeCrack"; Then it prints "AptitudeCrack".



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.