Hi guys! I just wanna ask on how to access the first character in a string?
danswater 0 Newbie Poster
Recommended Answers
Jump to PostDid you want to access the first integer in a string?
or the first character in an integer? :-)How about the first integer in an array of integers?
int myarray[10] = {1,2,3,4,5,6,7,8,9,10}; printf("%d\n", myarray[0]); printf("%d\n", *myarray); printf("%d\n", myarray[5]); int *p; p = myarray; printf("%d\n", *p++); …
Jump to PostHi guys! I just wanna ask on how to access the first character in a string?
Ok its my turn :)
first you have types of data in your case you can make it in two ways char and int
char means that you can input strings and …
Jump to PostThis is Turbo C guaranteed! ;)
/*Here is the code I wrote up to solve your problem. c Syntax (Toggle Plain Text) */ #include <stdio.h> #include <stdlib.h> int main() { char two_digit[3]; int digit; printf("Enter two digits: "); fgets(two_digit, 3, stdin); //Accept size-1 (in this case, 3-1 …
All 11 Replies
ryuurei 0 Newbie Poster
danswater 0 Newbie Poster
ryuurei 0 Newbie Poster
danswater 0 Newbie Poster
UncleLeroy 49 Junior Poster in Training
danswater 0 Newbie Poster
ryuurei 0 Newbie Poster
westony 0 Light Poster
danswater 0 Newbie Poster
Adak 419 Nearly a Posting Virtuoso
danswater 0 Newbie Poster
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.