snprintf and warnings

There are two warnings at the lines 4 and 5: deprecated conversion from string constant to 'char*'. Please help me,i don't know what it means.
P.S. don't look at the text of the snprintf, i made it for trying.

1
2
3
4
5
6
7
8
9
10
11
12
#include <stdio.h>
int main() {
char s1[32];
char* s2="Ciao";
char* s3="pippo";
int age=24;
snprintf (s1,21, "%s %s ho %d anniiusfhv", s2, s3, age);
// Scrivo su s1 attraverso la sprintf
// Ora s1 contiene la stringa "Ciao pippo ho 24 anni"
printf("%s",s1);
return 0;
}
type of string literal is const char[x] which can be converted to const char*. It is not compatible with char* at all. In fact it should be error. Compiler allows that because in old times when there were no standard and anarchy governed C++, it was allowed. Not anymore. At least for last 15 years.
Topic archived. No new replies allowed.