string in c with pointers !
when i am creating a C program , in which i am using Strings with the help of pointers !
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *ptr = "hello"; // line :: 1
printf("%s\n",*ptr); // line :: 2
return 0 ;
}
so ,
at line :: 1 , i am facing this problem ::
warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
at line :: 2 , i am facing this problem ::
warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘int’ [-Wformat]
|