BrainDump
  Home arrow BrainDump arrow C: Strings
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
BRAINDUMP

C: Strings
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-03-03

    Table of Contents:
  • C: Strings
  • Storing Strings
  • String Operations
  • Strcat()
  • Strcmp()
  • Strcpy()

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    C: Strings


    (Page 1 of 6 )

    We left off in our last tutorial noticing that the creators of C geared it towards numerics, and made it difficult to handle text in the language. Being a writer, this offends me greatly, and so in this article I will teach you to force C to do you bidding and deal with text.Sure, it will kick and scream. But in the end it'll all be worth it, because you can print the glorious text: “Hello World” to your screen.  

    Just a brief warning: if you've been following along in this series, you may see some information repeated from prior articles. Feel free to skip over it if you like. I've included it here as a reference.

    Stringing It All Together

    Simply put, a string is a group of characters. An example of a string would be a word: it, the, apple, hamburgers; a sentence: I like to eat bacon; and even random characters thrown together: alpha9fzxc1_beefrt. Strings are stored in memory as ASCII codes, representing the characters. C doesn't know its “G” from a hole in the ground. While you don't need to worry about knowing the various ASCII codes, here is a table of the “printable characters”:


    Ascii

    Character

    Ascii

    Character

    Ascii

    Character

    32

    Space

    64

    @

    96

    `

    33

    !

    65

    A

    97

    a

    34

    66

    B

    98

    b

    35

    #

    67

    C

    99

    c

    36

    $

    68

    D

    100

    d

    37

    %

    69

    E

    101

    e

    38

    &

    70

    F

    102

    f

    39

    '

    71

    G

    103

    g

    40

    (

    72

    H

    104

    h

    41

    )

    73

    I

    105

    i

    42

    *

    74

    J

    106

    j

    43

    +

    75

    K

    107

    k

    44

    ,

    76

    L

    108

    l

    45

    -

    77

    M

    109

    m

    46

    .

    78

    N

    110

    n

    47

    /

    79

    O

    111

    o

    48

    0

    80

    P

    112

    p

    49

    1

    81

    Q

    113

    q

    50

    2

    82

    R

    114

    r

    51

    3

    83

    S

    115

    s

    52

    4

    84

    T

    116

    t

    53

    5

    85

    U

    117

    u

    54

    6

    86

    V

    118

    v

    55

    7

    87

    W

    119

    w

    56

    8

    88

    X

    120

    x

    57

    9

    89

    Y

    121

    y

    58

    :

    90

    Z

    122

    z

    59

    ;

    91

    [

    123

    {

    60

    <

    92

     

    124

    |

    61

    “=”

    93

    ]

    125

    }

    62

    >

    94

    ^

    126

    ~

    63

    ?

    95

    _



    More BrainDump Articles
    More By James Payne


       · Thanks for stopping by to read my article on C Strings. Here we discuss how to store...
     

    BRAINDUMP ARTICLES

    - Basic Operations and Registers in Assembly
    - Assembly Coding within Visual C/C++ IDE
    - New Microsoft Office Coming with a Twist
    - Microsoft`s FUSE Labs Unveils Spindex Social...
    - HP Slate with Windows 7: Dead or Alive?
    - Windows Phone 7 Mobile OS to Rival Android a...
    - Windows 7 Climbing the Charts, Fights for Ma...
    - Windows 7 Upgrades to Come at Cheaper Prices
    - Microsoft Being Inventive in New Ways to Off...
    - Microsoft Prepares 64 GB Zune HD for Upcomin...
    - Windows 7 Trial for Businesses Gets Extension
    - Microsoft Refuses to Follow Others` Lead on ...
    - Microsoft Promises Plenty of Surprises for E...
    - Are Microsoft Certifications Worth the Cost ...
    - Microsoft, NSF Open Cloud Computing to Scien...





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek