know yourselves. information, computer, 7 wonders, various.

Sunday, November 12, 2017

C++ programming language part: 37 Function Scope


Function Scope

The scope of a name consists of that part of the program where it can be used. It begins where the name is declared.

Program 29_7

void a();                                                           // a() is global
void b();                                                           // b() is global
int x=11;                                                          // this x is global

main()
{
  int x=22;                                                        // begin scope of main()
            {
              int x=33;                                            // begin scope in internal block
            cout<<" Internal x = "<
             }
cout<<"  In main x= "<
cout<<" In main () :: x= " <<::x accesses="" endl="" global="" nbsp="" o:p="" to="">
            a();
            b();
}

void a()
{
int x=44;
cout<< "In a() x=  "<
}

void b()
{
cout<< "In b() x=  "<

}


Part- 86 assign the content of twostring



জ্ঞানকোষ প্রকাশনী
৩৮/২-ক, বাংলাবাজার (২য় তলা), ঢাকা।
       ফোনঃ ৭১১৮৪৪৩, ৮১১২৪৪১, ৮৬২৩২৫১.         
                                                     
কলকাতায় পরিবেশক/প্রাপ্তিস্থান
রিতা ইন্টারন্যাশনাল
৩৬, পি.এন. ব্যানার্জি রোড, কলকাতা
ফোনঃ ২৫১৩৮৩৫৯, ৯৮৩০৪৩৯৬৭৯, +৯১৯৮৩০৪৩৯৬৭৯


C++ programming language part: 38 String


String 

A string is a sequence of contiguous characters in memory terminated by null character '\0'. The C header file provides a wealth of special function for manipulating strings.





Once again tracing Pointer

The following program defines a float x and two pointers p and q. It prints their values and their address. it also prints the values of the objects that the pointer point to:

Program 29_8
{           float x=44.44;
            cout<< "x= "<
            cout<< "\t &x= "<<&x<
            float *p=&x;                                          // p points to x
            cout<<" p=  "<
            cout<<"\t &p=  "<<&p;                           // Prints address of p
            cout<<"\t *p=  "<<*p<
            *p=77.77;
            cout<<" p=  "<
            cout<<"\t &p=  "<<&p;
            cout<<"\t *p=  "<<*p<
            cout<<"x=  "<
            cout<<"\t &x=  "<<&x<
            float *q=&x;                                          // q points to x
            cout<<" q=  "<
            cout<<"\t &q=  "<<&q;
            cout<<"\t *q=  "<<*q<
            cout<<"x=  "<

            cout<<"\t &x=  "<<&x<


Part- 86 assign the content of twostring



জ্ঞানকোষ প্রকাশনী
৩৮/২-ক, বাংলাবাজার (২য় তলা), ঢাকা।
       ফোনঃ ৭১১৮৪৪৩, ৮১১২৪৪১, ৮৬২৩২৫১.         
                                                     
কলকাতায় পরিবেশক/প্রাপ্তিস্থান
রিতা ইন্টারন্যাশনাল
৩৬, পি.এন. ব্যানার্জি রোড, কলকাতা
ফোনঃ ২৫১৩৮৩৫৯, ৯৮৩০৪৩৯৬৭৯, +৯১৯৮৩০৪৩৯৬৭৯