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

    - Firefox on Windows Mobile
    - Microsoft`s Sneaky Firefox Add-On Installati...
    - Microsoft`s Answer to Google Search - Bing
    - Doing Statistical Analysis with MS Excel
    - Extracting Google-Indexed Web Site Pages Usi...
    - Advanced String Manipulation Using MS Excel
    - Using Goal Seek and Solver in MS Excel
    - Internet Explorer 8: A Hands-on View
    - Tools for Beginning Game Developers
    - XAMPP: Tips for Running an Apache/MySQL Serv...
    - Improving Your Visual Studio Workspace
    - A Look at Microsoft`s Mobile Operating System
    - Microsoft Internet Explorer 8: Mixed Reactio...
    - Configuring WSUS 3.0 on Windows Server 2008
    - Migrating to Windows Server 2008





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT