We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Mustafa Açık • 2 years ago

this expression helped me. Thanks a lot. Greetings from Turkey

Donotalo • 2 years ago

Thank you. I'm please to know that it helped you.

Abelardo León González • 4 weeks ago

Hi there,

When I declared & initialized this array:
char palos[NUM_PALOS][MAX_LONG_PALOS] =
{
"oros",
"copas",
"espadas",
"bastos"
};

and prints out the third position palos[2] should print "espadas" but "espadasbastos" is outputted. NUM_PALOS = 4 and MAX_LONG_PALOS = 7.
It happens on Ubunt 20.10 with C99 & CLion as IDE.

What's wrong?

Best regards,

Vaibhav Hake • 1 month ago

i want to get following string from user, how to do that

char arr[NUMBER_OF_STRING][MAX_STRING_SIZE] =
{ "array of c string",
"is fun to use",
"make sure to properly",
"tell the array size"
};

and then want to print the same

Nishikant Hingole • 2 months ago

Hello,
I am searching for the solution to extract pertecular string from the given string

$PMTK011,MTKGPS*08
$PMTK010,001*2E
$PMTK011,MTKGPS*08
$PMTK010,002*2D
$GPRMC,064512.498,V,,,,,0.00,0.00,270121,,,N*4B
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,064512.498,,,,,0,0,,,M,,M,,*49
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,1,1,00*79
$GLGSV,1,1,00*65
$GPGLL,,,,,064512.498,V,N*7B
$GPTXT,01,01,02,ANTSTATUS=OPEN*2B

I want to extract

$GPRMC,064512.498,V,,,,,0.00,0.00,270121,,,N*4B


Please help me out

Aqsa • 5 months ago

I have a file instead of string array and file contain lines i want to split comma separated words and using a loop which can automatically pass to the next line after the 1st line words completed.. kindly help me with this.

Philipe • 8 months ago

how to store result in new variable instead of print?

Peter • 10 months ago

Hi. There is a wrong basic assumption in this article. An array is not necessarily stored sequentially in memory. The first char can be stored in one memory location and the next in an entirely other location in memory, so you cannot simply advance the pointer by one.

upendra chaudhari • 1 year ago

these tutorials are still much better than many other similar websites or youtube channel

Gsb2 • 1 year ago

If I wanted to split a string using with char delim[] = "dr", is there any way that I can find out which character did was using to delimit every time it does that. For example, if the string is 40d50r30d.., is there any way that I could know that the 40 was delimited by the char d and the 50 was delimited by char r and likewise

Sunil Sheth • 1 year ago

Good tutorial with proper example
Thanks

hopefor • 1 year ago

I m signed up for ask this,why i must use define ? When i create an integer variable and put into char arr[x][y] as x and y integers i get an error.I wonder why this cause to an error?And thanks for post by the way

Donotalo • 1 year ago

In C you can't declare arrays as char arr[x][y] where x and y are variables. The compiler must know the size of the array at compile time. So you must declare the size as constant.

hopefor • 1 year ago

hmm, thanks for the info

shivam panchbhai • 1 year ago

suppose there are two strings and i need to find if the 1st character of the 1st string is present in the 2nd string then how to write code for this?

PaulEmmons • 11 months ago

It sounds as though strchr() would do that.

Srinivasan1 • 2 years ago

how to split Audi@9.8 as car nmae and its mielage and store it seperately

Donotalo • 2 years ago

You need to use strtok with '@' character, then use strcpy to copy the tokenized string to another string.

srini • 2 years ago

how to split Audi@10.8 as car name and mielage and store seperately

Donotalo • 2 years ago

Please check my previous answer.

Anonymous • 2 years ago

hello thank you this help. here I am able to split token,
But can you help how can i store each part of token in different variable?

Vikas Gupta • 1 year ago

use string array