Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. reserve string in c

reserve string in c

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mortadda jafar
    wrote on last edited by
    #1

    hello i want reserve string in c just using(string.h) such strcat and strcpy and strcmp libirty without (for or poniter) how???

    C 1 Reply Last reply
    0
    • M Mortadda jafar

      hello i want reserve string in c just using(string.h) such strcat and strcpy and strcmp libirty without (for or poniter) how???

      C Offline
      C Offline
      Condoriano Condoriano
      wrote on last edited by
      #2

      Hi, I thing when you say poniter its pointer. All strings and arrays in C are pointers so you cant change it. However if you want to create a string otherwise you can use malloc, with malloc you can create one array of any size, you can see it here But you have other way to do it, if you want to read a string for keyboard you may be need to use strdup() from string.h

      M 1 Reply Last reply
      0
      • C Condoriano Condoriano

        Hi, I thing when you say poniter its pointer. All strings and arrays in C are pointers so you cant change it. However if you want to create a string otherwise you can use malloc, with malloc you can create one array of any size, you can see it here But you have other way to do it, if you want to read a string for keyboard you may be need to use strdup() from string.h

        M Offline
        M Offline
        Mortadda jafar
        wrote on last edited by
        #3

        hay i want reserve without chang index for array exmple with change index:

        char array[20]; int i,j; gets(array); j=strlen(array); for(i=j-1;i>=0;i--) {printf("%c",array[i]) } i want use (strncat & strncpy with for)...for Reverse string but i don't know how i can do this :: ex ::

        char array[20]; int i,j; j=strlen(array); for(*******) { strncat(****) or strcat(***) or strncpy(***) or strcpy; } and in the end i want Reverse string :^) :^)

        L 1 Reply Last reply
        0
        • M Mortadda jafar

          hay i want reserve without chang index for array exmple with change index:

          char array[20]; int i,j; gets(array); j=strlen(array); for(i=j-1;i>=0;i--) {printf("%c",array[i]) } i want use (strncat & strncpy with for)...for Reverse string but i don't know how i can do this :: ex ::

          char array[20]; int i,j; j=strlen(array); for(*******) { strncat(****) or strcat(***) or strncpy(***) or strcpy; } and in the end i want Reverse string :^) :^)

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Please do not repost. You already have some suggedtions in your post in QuickAnswers[^].

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups