C Programming Tutorial # 19 - More on Strings - Part 1 [HD]

preview_player
Показать описание

In this tutorial we continue to talk about Strings, how they are used in C programming and how they are input and output.

This tutorial is part of the following series:
Рекомендации по теме
Комментарии
Автор

Just wanted to say thank you. I discovered your videos today -- they're awesome! I'm a student taking C online...these videos are EXCELLENT supplements to my book!

dudeharmonious
Автор

I am happy to learn from such Excellent Teacher. You make it so simple to understand.
Thank you so much.

mdmufti
Автор

@alla3na I am sorry to hear about your loss. I am glad I could help you in this situation. Makes it worth my time and efforts. Thanks for the feedback.

Learnorama
Автор

@foosta5 Thanks. I am glad you changed your mind. I appreciate you watching my tutorials and liking them, and leaving me comments. Thanks again.

Learnorama
Автор

Very good tutorials. Concepts explained very clearly.

Peter
Автор

@danielszabo1981 Great. I am glad I could help. Keep watching the tutorials. Hopefully the tutorials will make it easy for you to take you course.

Learnorama
Автор

@itsdannyftw When you declare an array you specify the number of elements it has, not the last element index. For example, when you declare char cName[10]; You declare a character array with 10 elements, ranging from 0 to 9. Now if you try to store "Learnorama" in it, you will overflow. The reason is that all the letters will occupy the 10 characters space in the array, and there is no space for the null character. So you should declare it char cName[11]; so that it has space for null char.

Learnorama
Автор

this is a good tutorial it clears up a lot of stuff

exia
Автор

Ahhh, okay that makes sense. It wouldn't print the address because %s is a formatter for strings and the address is an int. Also, like you said it tells you to treat the address as the startling location of the string and to print the string. That makes sense. Thanks for the response and I hope to see more videos soon.

MrCavitysChessCorner
Автор

thanks alot brother for your tutorials.love u ur awesome

yasir
Автор

I am just replying to you without watching the video. I believe the format specifier used must be %s. If so, the format specifier %s says that treat that address as the starting location of a string and print the string. That's why providing the address results in printing the string. So the magic is in %s. No if you change it to %p or %d or %i, you will get the address printed. See the point.

Learnorama
Автор

ty man i have an exam tommorow and i lost my notes and book (thanks to who ever stole them..
you just saved me... THANK YOU

allana
Автор

Quick question: Why didn't you have to do "*name" rather than just "name" for the second printf statement? I expected the terminal to print the address of the char array because I was told that if you have an array that the name of the array refers to its address in memory whereas "*nameOfArray" refers to the value at that memory address (Sohail in this case).

MrCavitysChessCorner
Автор

Thanks. Dont forget to visit CPlusPlusTutor. com

Learnorama
Автор

Thanks for watching. Dont forget to visit CPlusPlusTutor. com

Learnorama
Автор

char *Sohail = malloc(sizeof(char)*12);

will let you store a string with 11 characters. You forgot to multiply by 12.

Learnorama
Автор

hey sir, can u explain me like a beginner that what is the role of int x[10];. i watch the previous video but couldnt really get it.

sanchit
Автор

i think you can choose
char *Sohail = malloc(sizeof(char));
and with these you can enter up to 11 characters.
I think i am right :)

AlexIliopoulos
Автор

How do i make a string for a "code" which contains both letter and numbers

evfran
Автор

Thanks. I am not from Iran. But close. :-)
Dont forget to visit CPlusPlusTutor. com

Learnorama
visit shbcf.ru