hai can you please give me in detail how to write a c program for a sensors

This is not enough to go on. Are these sensors built into your computer? External sensors with some sort of network connectivity? What? Have you contacted the sensor manufacturer's web site for libraries/api's and such to communicate with them, or even to get their technical specifications?

Here is a typical eaxample ...

//
// http://www.airspayce.com/mikem/bcm2835/examples.html
//

#include <bcm2835.h>
#include <stdio.h>
// Input on RPi pin GPIO 15
#define PIN RPI_GPIO_P1_15

int main(int argc, char **argv)
{
    // If you call this, it will not actually access the GPIO
    // Use for testing
//    bcm2835_set_debug(1);
    if (!bcm2835_init())
        return 1;
    // Set RPI pin P1-15 to be an input
    bcm2835_gpio_fsel(PIN, BCM2835_GPIO_FSEL_INPT);
    //  with a pullup
    bcm2835_gpio_set_pud(PIN, BCM2835_GPIO_PUD_UP);
    // Blink
    while (1)
    {
        // Read some data
        uint8_t value = bcm2835_gpio_lev(PIN);
        printf("read from pin 15: %d\n", value);

        // wait a bit
        delay(500);
    }
    bcm2835_close();
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.