• Cursussen
  • Code Compiler
  • Discussiëren
  • Prijzen
  • Teams
Menu
0

how do i add a space character when storing an input string in a 2d array in c?

this is my code: #include<stdio.h> int main() { char names[20][20]; scanf("%s",names[1]); printf("^%s",names[1]); return 0; } should i use scanf with [^\n] ? or other code?

inputcarraystring
15th Jan 2022, 1:21 PM
Rey Vincent Ocero
Rey Vincent Ocero - avatar
1 Antwoord
0
https://stackoverflow.com/questions/54671314/2d-char-array-storing-text-with-the-spacebar-in-an-one-char-array-element
15th Jan 2022, 1:26 PM
NEZ
NEZ - avatar

Heb je vaak vragen zoals deze?

Leer efficiënter, gratis:

  • Inleiding tot Python

    7,1 miljoen leerlingen

  • Inleiding tot Java

    4,7 miljoen leerlingen

  • Inleiding tot C

    1,5 miljoen leerlingen

  • Inleiding tot HTML

    7,5 miljoen leerlingen

Bekijk alle cursussen
Populair vandaag
Is anyone else experiencing this Sololearn issue?
0 Votes
Best language?
0 Votes
solo learn program issue - iPhone?
1 Votes
How do I keep myself motivated in coding
0 Votes
Anyone have song names? Comment your favorites here for a project im working on
0 Votes
Bro can you fix yt error?
0 Votes
Learn - multiple choice course questions display in one box making it impossible to continue
1 Votes
Sql practice
0 Votes
I want to know how to make an Payment App like what I need to learn I need some guidance
0 Votes
Bug in Completing AI Practice
0 Votes