Consider there is a string
"hai welcome..."

I need to print the string as such leaving the first three characters..

I should not use in-built functions or others...

It should b done in a single printf statement by changing the control string pattern..

Recommended Answers

All 5 Replies

Can you be more specific? "Leaving the first three characters" is ambiguous. Do you want to print only the first three characters of a string, or all characters except the first three?

Can you be more specific? "Leaving the first three characters" is ambiguous. Do you want to print only the first three characters of a string, or all characters except the first three?

all others except the first three characters...

printf("%s\n", "hai welcome..." + 3);

Well if it should not be done with a single printf statement, then it should be done using pointers. Supposing you have a "str" variable of type char* to hold your string here is what you should do:

str += 3;
printf("%s\n",str);

thanks for the help friends...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.