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

void test(char *p)      //  test function
{
    p = "AB";
}

void fnc(char ch[])    // fnc  function
{
    strcpy(ch, "CD");
}

int main()
{
    char str[20] = "World";

    test(str);           // call test function
    printf("%s\n", str);

    fnc(str);            // call fnc function
    printf("%s\n", str);

    return 0;
}

asked 15 Jun, 19:53

Partho%20Debnath's gravatar image

Partho Debnath
233

edited 16 Jun, 07:32

Mosharraf%20Hosain's gravatar image

Mosharraf Hosain ♦
1.1k18


সি-তে স্ট্রিং সরাসরি কোনো ভ্যারিয়েবলে অ্যাসাইন করা যায় না। লুপ ব্যবহার করে একটি একটি ক্যারেক্টার বসাতে হবে, অথবা strcpy() ফাংশন ব্যবহার করতে হবে।

আবার

int* p; // pointer
p = 45  // wrong, trying to assign an address instead of value
*p = 45 // correct, assigning value to pointer
permanent link

answered 16 Jun, 07:38

Mosharraf%20Hosain's gravatar image

Mosharraf Hosain ♦
1.1k18

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×33

question asked: 15 Jun, 19:53

question was seen: 198 times

last updated: 16 Jun, 07:38