BrainDump
  Home arrow BrainDump arrow C: Strings
Iron Speed
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
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
     
     
    Iron Speed
     
    ADVERTISEMENT

    Lose your application development headaches. Start developing and deploying applications with Advantage Database Server today. Download a 30-day trial for Free!

    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

    - Multiple Service Contracts and Indigo
    - Cleaning Out Your Programs in XP
    - Handling Metadata with Indigo
    - Building Blocks for a WCF Service Web Site
    - Help! I Need Some Remote Assistance
    - Using Service Templates with Indigo
    - Windows XP Tips for Task Manager
    - Generating Clients and Services with Indigo
    - Vista SP1, A Review
    - Services and the WCF
    - VBScript: Final Date Functions
    - Creating Services with the WCF
    - The Resource View of the MFC
    - VBScript: More Fun with the Date Functions
    - Vista Price Cuts Dissected




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway