[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

General Programming Concepts: Writing and Debugging Programs


Example adb Program: adbsamp

The following sample program is used in this example:

/* Program Listing for adbsamp.c */
char  str1[ ] = "This is a character string";
int one = 1;
int number = 456;
long lnum = 1234;
float fpt = 1.25;
char str2[ ] = "This is the second character string";
main()
{
        one = 2;
        printf("First String = %s\n",str1);
        printf("one = %d\n",one);
        printf("Number = %d\n",lnum);
        printf("Floating point Number = %g\n",fpt);
        printf("Second String = %s\n",str2);
}

Compile the program using the cc command to the adbsamp file as follows:

cc -g adbsamp.c -o adbsamp

To start the debug session, enter:

adb adbsamp

Related Information

adb Debug Program Overview

Using adb Expressions

Example adb Program: adbsamp2

Example adb Program: adbsamp3


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]