Vinhtrinh - Tin Tức Hay, Siêu Hot Cập Nhật Hàng Ngày
  • Home
  • Bất Động Sản
  • Công Nghệ
  • Luật
  • Tài Chính
No Result
View All Result
  • Home
  • Bất Động Sản
  • Công Nghệ
  • Luật
  • Tài Chính
No Result
View All Result
Vinhtrinh - Tin Tức Hay, Siêu Hot Cập Nhật Hàng Ngày
No Result
View All Result

How Strings Work in C++ (and how to use them)

admin by admin
May 25, 2020
in Công Nghệ
43
How Strings Work in C++ (and how to use them)



Patreon ►
Instagram ►
Twitter ►
Slack ►

In this video we’re going to talk about how strings work in C++. Strings are groups of characters between double quotes: “this is an example of a string”. We use them to store everything from people’s names to entire paragraphs of text, and we can use them like any other variable. Strings are really just char arrays at the end of the day, and this video takes a deeper look at how they work.

std::string API reference ►

Pointers ►
Arrays ►

Series Playlist ►

Gear I use:
—————–
BEST laptop for programming! ►
My FAVOURITE keyboard for programming! ►
FAVOURITE monitors for programming! ►

MAIN Camera ►
MAIN Lens ►
Second Camera ►
Microphone ►

Nguồn: https://vinhtrinh.com.vn

Xem thêm bài viết khác: https://vinhtrinh.com.vn/cong-nghe/

Xem thêm Bài Viết:

  • Phần mềm quản lý bất động sản là gì?
  • Dash là gì? Tìm hiểu chi tiết về đồng tiền ảo Dashcoin
  • Top 3 ứng dụng xem phim online chất lượng cao trên di động
  • Giải pháp thiết kế website in ấn chuyên nghiệp, giá rẻ và chuẩn SEO
  • Khách hàng mục tiêu là gì và cách để xác định khách hàng mục tiêu hiệu quả
Previous Post

Tin tức bất động sản mới nhất ngày 23/5/2020 | Nông dân Bến Tre ồ ạt bán đất mặt ruộng

Next Post

Phát hiện hàng trăm xe máy cầm cố không chính chủ

Next Post
Phát hiện hàng trăm xe máy cầm cố không chính chủ

Phát hiện hàng trăm xe máy cầm cố không chính chủ

Comments 43

  1. Brotcrunsher says:
    2 years ago

    You've made a mistake at 7:03 "[…] otherwise you can just leave it as a char pointer that is totally fine.", implying that it is okay to change a char in that array.

    No it is not! That is undefined behavior and leaving a pointer to a String literal non const it deprecated since C++11. You must not change any value of the C-String-Literal!

    Reply
  2. Rodrigo Macedo says:
    2 years ago

    Hi Cherno. Where do you stand on using char* instead of string class when coding in C++? Would you always favor the usage of string class or can you think of a reason why not to?

    Reply
  3. demmordor says:
    2 years ago

    эх буржуйская кодировка

    Reply
  4. Lei Xun says:
    2 years ago

    My takeaways:
    1. C style string 5:30, and why he uses char* 9:00, because "anything inside a double quote is a char array" 14:10
    2. C++ style string 11:04
    3. Passing a string to function 16:13, it is better to pass by reference to avoid copy

    Reply
  5. Wes Gause says:
    2 years ago

    Love your stuff, I am a student learning C++, and your channel is my go to when I need help

    Reply
  6. cosmin cosma says:
    2 years ago

    when passing an object as argument, copy is made on stack, 17:18

    Reply
  7. שקד יעקובי says:
    2 years ago

    really good thank you

    Reply
  8. Daniyel Zhumankulov says:
    2 years ago

    hi Cherno, I hope you will answer when I wrote char n[ ]={'q', 'e'}; it printed without garbage even I did not implement a null character explicitly. Or is that what you said in the video applies only to the debug mode?

    Reply
  9. 血涩狼 says:
    2 years ago

    cool

    Reply
  10. soumyadeep pathak says:
    2 years ago

    const* char name = "Cherno";
    is giving me error : C++ a value of type cannot be used to initialize an entity of type.
    Can someone explain this to me?

    Reply
  11. Luke Nukem says:
    2 years ago

    Cherno!

    I copied your code, and you have no errors.

    My Code:

    main()

    {

    . . char* name = "Luke";

    }

    Resulting Error:

    E0144: a value of type "const char *" cannot be used to initialize an entity of type "char *"

    BUT then I see in your next video that you have to cast (char*) "";
    Why don't you have to cast that in this video???

    Reply
  12. N!cky says:
    2 years ago

    char* name = "Cherno" gives an error message:
    A value of type "const char*" cannot be used to initialize an entity of type "char *".
    Why does it work in the video?

    Reply
  13. MikeOnTheBox says:
    2 years ago

    17:05 Why on the heap if you not using the word new?

    Reply
  14. Injae Lee says:
    2 years ago

    The best C++ series on YouTube.

    Reply
  15. Yekna says:
    2 years ago

    You no longer need to use #include <string> in order to print strings at least that's what happens to me while using CodeBlocks

    Reply
  16. tinashe chaza says:
    2 years ago

    How is the Qstring arg method used?

    Reply
  17. Dima Rysev says:
    2 years ago

    Cool! Useful

    Reply
  18. eric c says:
    2 years ago

    char* name = "Cherno"; it's a mistake cause a value of type "const char *" cannot be used to initialize an entity of type" char * why doesn't your IDE underline the text with a red line? WHYYY?

    Reply
  19. CacheTaFace says:
    2 years ago

    These videos are so helpful, you are the MAN!

    Reply
  20. patrick ramos says:
    2 years ago

    what programming platform you use

    Reply
  21. Ojus Singhal says:
    2 years ago

    Your eyes freaked me out completely.

    Reply
  22. Dima Khodan says:
    2 years ago

    You told that string in function arguments dynamically allocated to heap, but it is not. Function arguments is a auto memory (stack allocation).

    Reply
  23. Shreyas Patil says:
    2 years ago

    I was able to use 'cout' to print the string to the console without including the string.h header file. But you said it will be an error. How come?

    Reply
  24. Hubert Wójtowicz says:
    2 years ago

    char* name ="Cherno"; //E0144 a value of type "const char *" cannot be used to initialize an entity of type "char * – VS 2019

    Reply
  25. Utkarsh Saboo says:
    2 years ago

    Hi why does "cout<<name<<endl;" return the name Cherno and not the address of the character 'C'?

    Reply
  26. Utkarsh Saboo says:
    2 years ago

    Hi can anyone explain why we can declare char* example = "cherno" but not int* example = {1,2,3,4,5}

    Reply
  27. Jon says:
    2 years ago

    reason why im just passing on my comp sci tests

    Reply
  28. Abhay Dwivedi says:
    2 years ago

    6:08
    I wrote same code in my vs2019 but it's giving error stating
    "cannot convert from const char[7] to char *"

    Reply
  29. Bigfoot is Just Really Shy says:
    2 years ago

    I tried your example
    char name2[6] = {'c','h','e','r','n','o'}

    and my output was fine, no strange ascii characters or anything. Maybe C++ has updated it since this video?

    Reply
  30. Highwind says:
    2 years ago

    const char * string = "String" is the same as declaring and initializing a const char array?

    Reply
  31. Isadora Toledo says:
    2 years ago

    If I want to change a string and pass it by reference, without the const word… for example:

    void ModifyString(std::string& string)
    {
    string+=" – Modified String!";
    }

    am I copying the string to the function?

    Reply
  32. Kavin nivak says:
    2 years ago

    what is the IDE u r using?……it looks good and more user friendly

    Reply
  33. Monish Kumar Durairaj says:
    2 years ago

    Hi cherno,
    As far I understand the string size when printing is determined by a zero..
    So if i wanted to print this string "cherno007"…
    Then it will print only cherno….and 007 won't be as 0 is considered as the null termination…

    Reply
  34. Vinícius Reis says:
    2 years ago

    Oh Man…. This is like Game Of Thrones! a Marathon I can only leave if I fall asleep…! Damn it!

    Reply
  35. Niklas Pfaff says:
    2 years ago

    Are his videos sped up?

    Reply
  36. yasoda1 says:
    2 years ago

    Yan, you are a Godsend!

    Reply
  37. loveboat says:
    2 years ago

    Since when is char* variable = "Cherno" a fucking array? And if so, why aren't you deferencing it when you use it later?!!??!!??!!?!?!?!?!?!?!?!?!? These are things you really should talk about. Useless video.

    Reply
  38. Chetan Shah says:
    2 years ago

    Watch at 1.25x thanks me later

    Reply
  39. Nishith Jupally says:
    2 years ago

    8:37

    name in char* name is a pointer variable
    and pointer variable is an integer(address value)
    then how cout<<name; is printing a string instead of integer?

    Reply
  40. pball1000 says:
    2 years ago

    Good stuff. VERY helpful. Thank you! Im learning so much

    Reply
  41. Uday Yadav says:
    2 years ago

    when you wrote name2 and then print it , it shows some random characters and you explained about them , but when i do this (using vs code , gcc c++11) i dont get anythin like that. why ?

    Reply
  42. jithin kg says:
    2 years ago

    now I know, thanks man

    Reply
  43. Nisha Rani says:
    2 years ago

    I need ur help can u help me plz???

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Xem Thêm

Thông tin rao bán được rao bán khắp nơi trên địa bàn quận Hoàng Mai.

Đất nền hạ nhiệt, sức hút dồn về biệt thự, liền kề

August 5, 2022
Thị trường bất động sản – đất nền tại Thủ Đức hiện nay như thế nào?

Thị trường bất động sản – đất nền tại Thủ Đức hiện nay như thế nào?

July 21, 2022
Giá đất nền Thủ Đức tăng sốc

Giá đất nền Thủ Đức tăng sốc

July 18, 2022
Giá nhà đất quận Tân Bình cuối năm 2019 dự kiến ​​chỉ tăng nhẹ

Đầu tư bất động sản Quận Tân Bình để sinh lời

July 15, 2022
Kinh nghiệm mua nhà mặt phố đống đa chất lượng

Kinh nghiệm mua nhà mặt phố đống đa chất lượng

July 14, 2022
HOẠT ĐỘNG MUA BÁN NHÀ TẠI BÌNH DƯƠNG MỚI NHẤT 2022

HOẠT ĐỘNG MUA BÁN NHÀ TẠI BÌNH DƯƠNG MỚI NHẤT 2022

July 8, 2022
  • Liên Hệ
  • Chính Sách Bảo Mật

© 2022 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Bất Động Sản
  • Công Nghệ
  • Luật
  • Tài Chính

© 2022 JNews - Premium WordPress news & magazine theme by Jegtheme.