Comma Operator (And When To Use It) | C Programming Tutorial

  Рет қаралды 2,418

Portfolio Courses

Portfolio Courses

Күн бұрын

Пікірлер: 17
@Fillmore634b
@Fillmore634b 26 күн бұрын
So many thanks to each of your videos! I myself study C and the possibly interesting topic for video creation is commas and the creation of variables in IF Conditions In C, unfortunately, you cannot write the following: if (int test = 5, test != NULL) { printf("yes "); } So here we declaring variable in if statement, that can be done since C99, but we cannot do it in one expression with comma operator. BUT we can do this: int test; if (test = 5, test ==5) { printf("yes "); } and it will work.
@saidrafili262
@saidrafili262 Жыл бұрын
Hello Sir. I have a question from the video. Why on 6:48 you declared a char variable with pointer? What is the difference between char *sr1 = "a string to print from the middle"; and char sr1[ ] = "a string to print from the middle" ? Why do you use pointer? In C++ when I declare a variable like this, I get the error ' ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] ' Thank you beforehand.
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Great question Said! :-) This video explains the difference between the two: kzbin.info/www/bejne/h6GWiJSqgbGSfsU. :-) We could have used char s1[] in this video and it would have worked too, there isn't any reason in particular why I used a pointer. If we needed to modify the string we would definitely want to use char s1[] instead though, the video will hopefully explain this for you.
@saidrafili262
@saidrafili262 Жыл бұрын
@@PortfolioCourses Thank you so much Sir!
@PortfolioCourses
@PortfolioCourses Жыл бұрын
@@saidrafili262 You're welcome Said! 🙂
@mehdi-s6r
@mehdi-s6r 5 ай бұрын
That is useful, thanks sir
@drigao52
@drigao52 2 жыл бұрын
which IDE do you use?
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Hi Rodrigo! I use Xcode on Mac. Though sometimes I use Visual Studio Code & gcc on a terminal / command-line. :-)
@lioncraft5842
@lioncraft5842 2 жыл бұрын
Hmm can u do video using pointers &2D arrays ....🙈
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
So we have videos on pointers: kzbin.info/www/bejne/aHinmot9areZhKc And 2D arrays: kzbin.info/www/bejne/kIazl4qwidGDmKc But do you want a video on pointers and 2D arrays together? Like how to dynamically allocate 2D arrays for example? :-D That's a good idea too!
@JH-ux1re
@JH-ux1re 2 жыл бұрын
Haha, I’m learning this part too! So confused 😕
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
@@JH-ux1re Just curious, what types of questions are your instructors giving you on these concepts?
@JH-ux1re
@JH-ux1re 2 жыл бұрын
@@PortfolioCourses The assignment last week asked us to print Pascal triangle (not a tree, but right triangle) and the rainfall data for four weather stations in a certain county recorded in the table.
@JH-ux1re
@JH-ux1re 2 жыл бұрын
@@PortfolioCourses My professor didn’t ask us to use file open to read the table, but I want to know how to use it instead of typing all the data in the curly bracket. If you could make a video to show how to use file open and 2D arrays to read a table and do some calculations and write to a new txt file, that would be super great! The finals are coming, I really want to do a good review! Thank you!
@Jeremyak
@Jeremyak 4 ай бұрын
🤯
String In Char Array VS. Pointer To String Literal | C Programming Tutorial
9:58
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
"Clean" Code, Horrible Performance
22:41
Molly Rocket
Рет қаралды 943 М.
C++ - Comma Operator
7:06
Coding Jesus
Рет қаралды 2 М.
Writing Code That Runs FAST on a GPU
15:32
Low Level
Рет қаралды 577 М.
one year of studying (it was a mistake)
12:51
Jeffrey Codes
Рет қаралды 226 М.
Function Basics | C Programming Tutorial
15:36
Portfolio Courses
Рет қаралды 78 М.
why do hackers love strings?
5:42
Low Level
Рет қаралды 432 М.
Learn Any Programming Language In 3 Hours!
22:37
Code With Huw
Рет қаралды 634 М.
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 342 М.
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 318 М.