Back to Browse

Declaring and Initializing String Variables in C | C Programming Tutorial for Beginners

924 views
Premiered Jan 12, 2023
9:07

Master C Programming and take your career to new heights with this clear, concise C course. Click here to Register: https://courses.sandipbhattacharya.com/courses/C-Programming-for-Beginners You can initialize a string as follows: char greeting[6] = {'H', 'e', 'l', 'l', 'o', '\0'}; A more convenient way to initialize the above string is char greeting[] = "Hello"; You do not need to add the null to the end of string constants manually. The compiler does this for you automatically. Note that, if the string is initialized where it is declared, mentioning the string size is optional. A string can also be initialized and printed using normal scanf() and printf() functions respectively just like any other variable. Unlike arrays, we do not need to print a string, character by character. It has a format specifier “%s” which can be used to directly print and read strings. In this program, we'll demonstrate how to declare and initialize a string variable in C. Hope you learn something new from this tutorial. | -------------------------------------------------------------------- | 👍🏻 Subscribe to this Channel https://www.youtube.com/c/SandipBhattacharya?sub_confirmation=1 ► Introduction to Programming with C (2 hours of video content) https://www.youtube.com/playlist?list=PLGY_UftsHsIY8gcOd32a_jg_cCS_h776m ► Android Apps and Games Development for Beginners (12+ hours of video content) https://www.youtube.com/playlist?list=PLGY_UftsHsIa-7gHJj_8NzVUb5MPizGg- ► Android Game Development Tutorial in Android Studio (2+ hours of video content) https://www.youtube.com/playlist?list=PLGY_UftsHsIYpPHukoiP3-XY1agajzmpB ► Build a Complete Quiz App for Android https://www.youtube.com/playlist?list=PLGY_UftsHsIbM_k7VojE8vZxnmiWXMSnZ ► Android SQLite Programming for Beginners (2.5 hours of video content) https://www.youtube.com/playlist?list=PLGY_UftsHsIZDnXQk4BLUb-voVO4hQMmm ► Android Game Development in Android Studio: Build Games for Absolute Beginners (3+ hours of video content) https://www.youtube.com/playlist?list=PLGY_UftsHsIZtNO0k-mvG_s6-VmWAlc2y ► Android Game Development - Create Your First Mobile Game https://www.youtube.com/playlist?list=PLGY_UftsHsIYLG2TdgGvQV2FE3NH5pr6c ► Android Game Development Tutorial https://www.youtube.com/playlist?list=PLGY_UftsHsIZBtrHB_igJnzgiqPgB8LZz ► Programming Flappy Bird for Android https://www.youtube.com/playlist?list=PLGY_UftsHsIb9n-igirQzp1Zoo5FpYCac ► Object Oriented Programming Fundamentals https://www.youtube.com/playlist?list=PLGY_UftsHsIYhTXaYrqUEVUkE-Uh7Ioel ► jQuery for Beginner to Advanced https://www.youtube.com/playlist?list=PLGY_UftsHsIatqRv-Fxn44opl-LoyFiMi ► PHP MySQL CRUD Tutorial (Create, Read, Update, Delete) (1+ hour of video content) https://www.youtube.com/playlist?list=PLGY_UftsHsIaIcSLmDNiWlA2ZRUEiwBc4 ❤️ You can donate by clicking here. Thank you! PayPal: https://paypal.me/CreatorSandip For Indians: https://www.instamojo.com/@CreatorSandip ✉️ For Business Inquiries [email protected] 📣 Follow me on other sites → Website: https://SandipBhattacharya.com → Udemy: http://bit.ly/SandipUdemy → Skillshare: http://bit.ly/SandipSkillshare → Google Play: http://bit.ly/SandipPlay → Facebook Page: http://bit.ly/SandipFacebook → Facebook Group: https://bit.ly/PWSGroup → LinkedIn Group: https://bit.ly/PWSGroupLI → Twitter: http://bit.ly/SandipTwitter → GitHub: http://bit.ly/SandipGitHub

Download

1 formats

Video Formats

360pmp411.0 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Declaring and Initializing String Variables in C | C Programming Tutorial for Beginners | NatokHD