test

Wednesday, August 10, 2011

so long time that I don't update this blog.. :p

Using Pointer

Monday, October 19, 2009

This will show You about simple using pointer in C.

#include<stdio.h>

int main(void){
    int y, x = 87;
    int *px;

    px = &x;
    y = *px;

    printf("Giving x = 87 (integer)\n");
    printf("px = &x;\n");
    printf("y = *px;\n\n");
    printf("Address of x = %p\n", &x);
    printf("Content of px = %p\n", px);
    printf("Content of x = %d\n", x);
    printf("Value that being pointed by px = %d\n", *px);
    printf("Value of y = %d\n", y);

    return 0;
}

Dayung Sampan

Monday, October 12, 2009

I'm listening to the Indonesia Folk Song, called "Dayung Sampan". This song accompany me during finishing my last task..:)



Copying Array to Another Array

This code will explain You how to copy from one array to another array..

#include<stdio.h>
#define MAKS 30

int main(void){
    int i;
    char asal[] = "I like C...";
    char hasil[MAKS];

    i = 0;
    while(asal[i] != '\0'){
        hasil[i] = asal[i];
        i++;
    }

    hasil[i] = '\0'; // give null char
    printf("Content of hasil: %s\n", hasil);

    //return 0;
}

Another Code to Count Char in A Sentence

Saturday, October 10, 2009

This is the another method, we are using string.h

#include<stdio.h>
#include<string.h>

char line[100]; //max 100 chars of input

int main(void){
    printf("Enter the sentence: \n");
    fgets(line, sizeof(line), stdin);

    printf("The length of the sentence is: %d\n", strlen(line));
    return 0;
}

 
 
Copyright © Welcome