Working with character arrays and 'strings' in C

preview_player
Показать описание
Learn some basics on character arrays and strings in C. Learn how to declare, modify, output, and manipulate character arrays and C strings.

Hope you enjoyed the video!

Check out this code here:

Join my Discord server to chat with me:

Check out some code on my GitHub:

Tweet me something funny on Twitter:

Say hi over at Facebook:

Sincerely,
Engineer Man
Рекомендации по теме
Комментарии
Автор

you're saving me from a professor who can't teach so I'm gonna watch all the ads I need to I love you

nobantahir
Автор

in less than 6 minutes you taught me more about C and strings in C than i ever learned in a full semester on C programming. thank you, @EngineerMan!!

aj-sknf
Автор

Thank you! Easy to understand as a beginner and straight to the point

nahoooj
Автор

Amazing content, great explanations. I love those short but really good comments for every code line!

remotetechie
Автор

Incredible, short and easy to understand. Thank you!

mikobrown
Автор

Very precise an informative video .Thank you for uploading and hoping to see further more videos like this.

shailendrakunwar
Автор

Great vids for brushing up on c before some classes, much love brother

devinramsden
Автор

Great explanation. Would appreciate something on structs if possible, in particular use of the flexible array member (unsized last element in struct). thanks

Mike-gseo
Автор

you explained more about strings in 6 minutes than my teacher did in the whole semester...

QmVuamFtaW
Автор

Dude this is so trippy coming from Java, thank you!

soundsgood
Автор

Best explanation so far on c strings. Thanks

EchoVidsu
Автор

Nice content full of information. Thanks clearing the doubts.

bishtss
Автор

Engineer bro I want to thank you so much you need to teach I mean that! I had 2 eureka moments watch this video!

bigfella
Автор

Succinct and to the point. Very educational.

Here's a challenge, using Git to control a solo project from multiple computers. Git still seems nebulous and complex. Maybe you can show us how with no time a wasting.

chantelleboutin
Автор

thank you engineer man... Your videos help a lot !

pwlegolas
Автор

To print integer arrays, we would normally need a loop and some variable to move through the indices, one after the other.
But why isn't this the case with character arrays? Why do we just type the array variable name and everything works fine?

shibah
Автор

Thanks for another helpful video! Could you possibly do one on creating different structures in C, for example a Binary Tree?

kelechistewart
Автор

Awesome and succinct. Thanks a ton for these.

RussTeeTrombone
Автор

Hi Engineer Man! Thank you for posting this video and welcome to YouTube! In your intro video you said that you like video request so here is one for you... I am trying to create a program in C to load a tab delimited text file, from any folder on my computer(in the future to be input from the user), print the text (strings, I believe) from the text document to the screen, then sort the information based upon a certain column, reprint it to the screen, and then finally save it to a new text file. Can you help me, and everyone else, by showing me how I might go about doing this? This is not for hw/class, it is a personal project.

Here is what I have so far:

#include <stdio.h>
#include <string.h>
#define N 30
int main()
{
char name[];
char course[];
FILE *pointer = fopen("C:\\Users\\Jesse Hight\\Desktop
\\TutoringCodeFolder\SimplifiedStudentRequests", "r");
test=fscanf(pointer, "%s, %s", &name[N], &course[N]);

printf("%s\t%s", name[ ], course[ ]);
fclose(f);

/*
Idea:
row 1 of array 1 (from the original file)=row 1 of array2.
search array 1 for a course equal to row 1 of array 2.
for( )
if(array1[i][2]==array2[1][3]
array2[k][L]=array1[i][2]
k++
L=3
else
search array1 for new subject not equal to current/last row of array2
new subject from array1=next row of array2
*/

}


The original text file looks like:

Jesse ES 330-01
John MA 330-01
Alexa MA 330-01
Jose FN 361-01
Dave FN 361-01
Gabriel ES 330-01
Steve FN 361-01
Parker FN 361-01
Robert FN 361-01
Caroline ES 330-01


And I would like the output to be like this, with the list sorted by common classes:

Jesse ES 330-01
Caroline ES 330-01
Gabriel ES 330-01
John MA 330-01
Alexa MA 330-01
Jose FN 361-01
Dave FN 361-01
Steve FN 361-01
Parker FN 361-01
Robert FN 361-01


Thank you!

justin_time
Автор

Isn't the NULL byte '/0' the same as 0 or zero? I have successfully used a plain zero to terminate strings in C. Is that just a compiler specific (Boreland 4.5) exception?

andydelle