#21 C Strings | C Programming For Beginners
Вставка
- Опубліковано 21 лип 2024
- #21 C Strings | C Programming For Beginners
In this video, we will learn about strings in C. With many examples we will show you how to can create strings. Then we will learn to take String input and we will also show you how we can access and change each character of the string using indexes in C programming.
This video is a part of our C Programming video series: • #1: Getting Started wi...
~
Resources:
C Online Compiler: www.programiz.com/c-programmi...
Github File: github.com/programiz/c-youtub...
C (title) Tutorial (text-based tutorial): www.programiz.com/c-programmi...
Timestamps:
00:00 Start
00:16 C Strings
02:45 String Input
05:58 Access Characters of a String
07:49 Change Characters of String
9:12 Programming Task
9:54 Quiz
~
Revise your learning using our C App
Download here for Android: bit.ly/3upaInx
Download here for iOS: apple.co/3EZLtNq
Find Programiz elsewhere:
Programiz pro: programiz.pro
Website: www.programiz.com
Discord: discord.gg/programiz
Facebook: / programiz
Instagram: / _programiz
LinkedIn: / programiz
Twitter: / programiz
#programiz #cstrings #cprogramming #learnc #strings #array #index #Cstring
🔥Finding it Damn Hard to Understand C Programming?
Learn to code-the right way-with interactive lessons, quizzes & challenges. Build a strong programming base; it's IMPORTANT!
Try Programiz PRO for Free: bit.ly/master-c-programming
#include
int main() {
char str[50];
printf("enter your name :");
fgets(str,sizeof(str),stdin);
str[0]='X';
printf(" new name :%s",str);
return 0;
}
Currently studying for tmr's programming test. I had a hard time trying to understand C programming until I found this channel. Thank you!
last week i went for an interview in a core company and they told me to learn C programming so this channel helps me a lot.
I am currently doing lab assignments in a course about C programming, and these videos are really great "lectures";
I actually enjoy them a lot more than my official lectures for the course, haha.
Timestamps:
00:00 Start
00:16 C Strings
02:45 String Input
05:58 Access Characters of a String
07:49 Change Characters of String
9:12 Programming Task
9:54 Quiz
ans for that is Error pls reply;
option c. jack
Thank you for the clear and simple demonstration. getline() was not the right function to use and you helped me see that. Cheers!
Wonderful intro to strings in C, for the quiz because its using scanf and not fgets it will only have C. "Jack "
and this is the code practice
#include
int main() {
// Write C code here
char str[20];
printf("Enter your name: ");
fgets(str, sizeof(str), stdin);//this will get the entier input with spaces
str[0] = 'X';
printf("%s",str);
return 0;
}
This series of video helps me to understand C language more and the content was very explainable and entertaining. Thank you so much Programiz! #HighlyRecommend
Content is explained very clearly! The video was really useful 🥰
#include
int main() {
char str[30];
printf("enter your name");
fgets(str, sizeof(str), stdin);// replaces scanf, its role its to take input till the end of line
str[0] = 'X';
printf("%s ", str);//accessing the i in naomi using string index
printf("%c ",str[4]);
return 0;//fgets function str- name of string.sizeof the strinf, second parameter, stdin means standard input typed in from keyboard
}
If there's an ad runnning on the video, let them run the entire ads, just let it feels like you are watching on TV, and there are ads on it, through these we can help them, after all, we learn from these guys, for free....
Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls
Very good explanation...keep doing it. Thank you Programiz.
I appreciate this channel. My college teachers don't teach programming and they send us to teach ourselves with reading text books and marking our tests and workshops.
That’s because you’re in community college.
Love your videos! Helps me a lot.
Thank you, you are a hero!
Thank you very much for your helpful videos, I’m currently taking C programming and your videos are the best tools for me to study. Also, who doesn’t like to watch a beautiful woman teaching C, you are absolutely gorgeous!
Answer wil be "jack"
Ohhhhh
What a content
Good place in good time
so helpfu, thank you very much!
Thanks Alot Sister❤️
Can somebody pls tell me that while printing string we dont use ampersand so how come in the Uiz que she uses ampersand in the printf statement and the answer is Jack????? Pls
Mam yaha pr "string" jo hai vo " constant" ka part hai to token ka part kaise ho sakta or ye koi dusara string hai. Please explain me 🤔🤔🤔
Thanks a lot 🥺🥺🥺
Amazing 😍😍😍
Great video!!
NICE CONTENT ♥️👌
Programming Task :
#include
int main(){
char name[20]="Tushar Mahajan";
printf("enter your name:");
fgets(name, sizeof(name), stdin);
printf("%s",name);
name[0]= 'X';
printf("%s",name);
return 0;
}
Hello, I need your help with a question.
Consider P(x)=anxn+...........+a1x1+a0
Write a program that gets from the keyboard coefficients values an,..........,a0 and stores them in a table of floating type of dimension 5 .
The integer n and the real x are also introduced from the keyboard
Calculate P(x).
I need an answer as soon as possible.
Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls
Omg thank youu 😍
💗thank you so much .....
amazing teacher😍
Love it!
Thanks a lot
Mam adding two matrix program explainations
Why we are int main in function
Thank you
thanks!
ur complier is some wht different from another c compliers!!!#include
int main(){
char name[100];
scanf("%s", &name);
printf("%s",name);
return 0;
}
it taking & in strings !!!
Great veido...
Be aware to use ' ' instead of " " !!
Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls
(jack)output as the user provided space in between user input
nice
I have a doubt, can i decide the size of array like she used it in here as char str [20]; is there any problem in changing the size to 30 or 40, plz anyone reply😢
no its no problem in changing the size
Can somebody pls tell me that while printing string we dont use ampersand so how come in the Uiz que she uses ampersand in the printf statement and the answer is Jack????? Pls
good
#include
int main(void)
{
char mube[25];
printf("Enter your name: ");
fgets(mube, sizeof(mube), stdin);
mube[0] = 'X';
printf("%s", mube);
return 0;
}
Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls
Support!!!!
Thanks Madam...
Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls
int main(void)
{
char name[20]; // declaring the array of characters
// Displaying the name to enter
printf(" Enter your name :
");
// Storing the name to enter in the address of the array
fgets(name, sizeof(name), stdin );
name[0] = 'X'; // We want to replace the value of the first letter in the name by X ( index 0 )
// we want to display the characters (name) with the first letter replaced by X
printf("%s
", name);
return EXIT_SUCCESS;
}
Consider
P(x)=anxn+...........+a1x1+a0
Write a program that gets from the keyboard coefficients values an,..........,a0 and stores them in a table of floating type of dimension 5 .
The integer n and the real x are also introduced from the keyboard
Calculate P(x).
I need an answer as soon as possible.
Do you have time left?
#include
int main(){
int n, i;
float P, a, x, xn;
printf("Input n: ");
scanf("%d", &n);
printf("Input x: ");
scanf("%f", &x);
P=0.0;
xn=1.0;
for(i=0; i
You can also use this:
#include // Include the standard(std) input(i) output(o) library header file for your program
#define _v(var) a##var
/* a C macro which which can be used to give names to our coefficients from a0 to an, we won't be using it now as it is not needed and could be ignored
Search online to learn about C macros (preprocessors)
*/
//Main function start below which will run when we run the code
int main(){
// integer n will store the value of input n, and i will be used for loop
int n, i;
/* P will store the sum a0x0 + a1x1 + ... + anxn
x will store the value of input x
*/
float P, x, xn;
printf("Input n: ");
scanf("%d", &n);
printf("Input x: ");
scanf("%f", &x);
float a[n]; // we take an array of size n which will store our coefficients a0 to an, this is not needed but we will use it.
P=0.0;
xn=1.0;
for(i=0; i
More video
Q. What will be the value of the name variable if we provide Jack Sparrow as input value?
char name[20];
scanf("%s", &name);
A. Jack Sparrow
B. Sparrow
C. Jack
D. Error
Error
@@josephelson it's an error dude,name is already a pointer , or refence to 20 char, we dont need to pass name's reference(&name) for user input.
Error
D . Error
Error
The answer is Jack
#include
int main(){
char name[20];
printf("Enter Name: ");
scanf("%s", &name);
printf("%s", name);
return 0;
}
The output is Jack
Answer : C (Jack)
task:
#include
int main() {
char string[20];
printf("Enter your name:
");
fgets(string, sizeof (string), stdin);
string[0] = 'X';
printf("%s", string);
return 0;
}
I assume, it would be an error as there is no printf function there...
Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls
👏👏👏
option D
because of the ampersand?
Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls
ans C : jack
quiz answer:
C. Jack
(P.S. You can check and confirm using the compiler)
Error
error bcoz in scanf & is given to str
No dude the output will not lead to an error . Just as you mentioned in the last case for str it worked because it was the name of the string and here the name of the string is name and hence both actually are doing the same thing but with a different face
C is the answer
error?
i think u gtot some knowledge that
must be shared
❤❤❤
Error is the correct answer for this last question
Please provide videos for c++ programming
answer is C, Jack
" Your smile😀 is so, Beautiful, so keep smiling always 😁😋"
D. Error
Option C. JACK
Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls
Programing task:
#include
int main() {
char ita [50];
printf("what is my name: ");
fgets(ita, sizeof(ita), stdin);
ita[0] = 'x';
printf("%s", ita);
return 0;
}
/*
Create a program that takes your fullname as
input and prints your name.Then, change the
first letter of your name to X.
* If your name is John Williams, it will become
Xohn Williams.
* If your name is Julie Bing, it will become Xulie
Bing.
*/
#include
int main(){
char name[100];
printf("Enter your name: ");
fgets(name, sizeof name, stdin);
printf("
");
printf("%s
", name);
name[0] = 'X';
printf("%s
", name);
return 0;
}
Return "CHEERRIO" 😂😂😂
answer of last question is error
4. Error
Quiz Answer is Jack
Only Jack is printed
Programming Task :
#include
int main()
{
char name[30];
printf("Enter the name: ");
fgets(name, sizeof(name), stdin);
name[0] = 'X';
puts(name);
return 0;
}
and you type in return "CHEEERIO" LMAOOO 🤣🤣🤣🤣
Quiz answer is c
Quiz: C
The answer is Jack
opt c , jack
Answer b
Programing quiz andlswer : jack
Quiz = C
answer of quiz is :
jack
#include
int main (){
char str[20];
printf("Enter your Name:");
scanf("%s", str);
str[0] = 'X'; // it allows us to create the first name is 'X' .
printf("%s", str);
return 0;
}
John
#include
int main() {
char str[20];
printf("Enter your name: ");
fgets(str, sizeof(str), stdin);
str[0] = 'X';
printf("Your name is %s", str);
}
JACK
//C program to print Name and replace first character with X
#include
int main() {
// Write C code here
char str[30];
printf("Name: ");
fgets(str, sizeof(str), stdin);
printf ("%s", str);
str[0] = 'X';
printf("
%s", str);
return 0 ;
}
the answer is "C"
quiz ans: C
The answer is C.
c.jack
mhmm
Jack
jack
#include
int main()
{
char str [] = "Piash";
str [0]= 'X';
printf("%s",str);
return 0;
}
error