Posts

Showing posts with the label Pointer to String

Pointer to String पॉइंटर टू स्ट्रिंग or Pointer of String पॉइंटर ऑफ़ स्ट्रिंग or String Pointer स्ट्रिंग पॉइंटर

A pointer variable which stores the memory address of the first element or base address of a character array (string) is called a pointer to string or string pointer. एक करैक्टर टाइप का पॉइंटर वेरिएबल जो करैक्टर ऐरे या स्ट्रिंग के प्रथम एलिमेंट का मेमोरी एड्रेस स्टोर करता है, पॉइंटर टू स्ट्रिंग (Pointer to String) कहलाता है। Syntax: char array_name[size], *ptr_name; ptr_name = array_name; Example: char name[20], *p; p = name; In the above example, pointer p stores the base address of character array name , that is, the address of its first character. उपरोक्त उदाहरण में पॉइंटर p , करैक्टर ऐरे name का बेस एड्रेस अर्थात उसके पहले करैक्टर का मेमोरी एड्रेस स्टोर करता है। C Program for Pointer to String #include <stdio.h> #include <conio.h> void main() { char name[20], *p; clrscr(); printf("Enter name of a student:\n"); scanf("%19s", name); p = name; printf("Name of Student is = %s", p); getch(); } Output: Enter ...