Sunday, March 26, 2017

Pointer Basics

What is a Pointer?

A pointer is a variable that stores a memory address.  Pointers are used to store the addresses of other variables or memory items.  Pointers are very useful for another type of parameter passing, usually referred to as Pass By Address.  Pointers are essential for dynamic memory allocation.

Declaring pointers:

  • Pointer declarations use the * operator.  They follow this format:
       typeName * variableName;
    
     int n;        // declaration of a variable n 
     int * p;      // declaration of a pointer, called p 
    
  • In the example above, p is a pointer, and its type will be specifically be referred to as "pointer to int", because it stores the address of an integer variable. We also can say its type is: int*
  • The type is important. While pointers are all the same size, as they just store a memory address, we have to know what kind of thing they are pointing TO.
      double * dptr; // a pointer to a double 
      char * c1;  // a pointer to a character
      float * fptr;  // a pointer to a float
    
  • Note: Sometimes the notation is confusing, because different textbooks place the * differently.  The three following declarations are equivalent:
     int *p; 
     int* p; 
     int * p; 
    
    All three of these declare the variable p as a pointer to an int.

Character Sequence

The string class has been briefly introduced in an earlier chapter. It is a very powerful class to handle and manipulate strings of characters. However, because strings are, in fact, sequences of characters, we can represent them also as plain arrays of elements of a character type.

For example, the following array:

 
char foo [20];


is an array that can store up to 20 elements of type char. It can be represented as:

Arrays and Functions

Arrays and Functions


  • Things to note about C-style arrays:
    • An array is not a type
    • An array is a primitive C-style construct that consists of many items stored consecutively and accessed through a single variable name (and indexing)
    • This is actually done by remembering the starting address of an array, and computing an offset
    • The name of an array acts as a special kind of variable -- a pointer -- which stores the starting address of the array
  • An array can be passed into a function as a parameter
    • Because an array is not a single item, the array contents are not passed "by value" as we are used to with normal variables

Array Basics

Array Basics

Definition

An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.

That means that, for example, five values of type int can be declared as an array without having to declare 5 different variables (each with its own identifier). Instead, using an array, the five int values are stored in contiguous memory locations, and all five can be accessed using the same identifier, with the proper index.
An array is an indexed collection of data elements of the same type.
1)  Indexed means that the array elements are numbered (starting at 0).

Saturday, March 25, 2017

COMSATS Institute of Information Technology

COMSATS Institute of Information Technology

COMSATS Institute of Information Technology, also known as CIIT, is a public research university in Pakistan. It is a multi-campus institute with its headquarters located in the urban area of Islamabad. Established by the Commission on Science and Technology for Sustainable Development in the South which was established in Islamabad on 4 & 5 October 1994, the commission as of 2015 has 23 member state. The CIIT was established in 1998 with charter in August 2000.

Allama Iqbal Open University

Allama Iqbal Open University

Allama Iqbal Open University (Urdu: جامعہ علامہ اقبال‎) or AIOU is a public research university located in Islamabad, Pakistan. The university is the fourth world's largest institution of higher learning, with an annual enrollment of 1,121,038 students (as of 2010), the majority of them women, and Course Enrollment of 3,305,948 (2011). Established in 1974, it is also Asia's first open university with a strong emphasis on providing distance education in engineering, law, philosophy, natural and social science. It is considered the most attractive university in the country and has the most applicants per year. The university offers extensive undergraduate, post-graduate, and doctoral programmes in various academic disciplines. After witnessing the success of Open University in the United Kingdom, the university was established as a public university in 1974. It is noted for its cost-effective policy to provide higher education at a minimum cost through a specialized university fund managed by the government.

Saturday, March 18, 2017

Sukkur Board announces exam schedule for SSC-I, II


SUKKUR: The Sukkur Board of Intermediate and Secondary Education (BISE) issued on Wednesday the schedule for annual examinations of the secondary school certificate part-I and II (Class-IX and X) in affiliated high schools of Sukkur, Ghotki, Khairpur and Naushehro Feroze district.

According to a handout, the examinations will start from March 28 and conclude on April 8 in which a total of 102,642 girls and boys will take part.

QAU employees protest after VC sends registrator on forced leave

ISLAMABAD: A large number of the Quaid-i-Azam University’s (QAU) employees on Wednesday staged a protest against the vice chancellor for forcibly sending the registrar on leave and the university not resolving their issues.

The varsity’s vice chancellor, Dr Javed Ashraf sent Registrar Dr Shafiqur Rehman on forced leave on Wednesday saying this was according to the decision of the syndicate, which met on Monday and consists of 13 members including some lawmakers, three QAU faculty members, secretary Ministry of Education and a representative of the Higher Education Commission (HEC).

Teachers give govt two weeks for their promotion

PESHAWAR: The All Teachers Coordination Council, Khyber Pakhtunkhwa chapter, has warned of launching a province-wide protest campaign if the government failed to accept its demands for award of time-scale promotion, jobs quota for teachers’ siblings, and teaching allowances within two weeks.

Rs 6 b scholarships for girl students of 16 districts

LAHORE: Chief Minister Shahbaz Sharif has launched “Khadam-e-Punjab Zewar-e-Taleem Programme” in 16 districts of South Punjab under which educational scholarships worth Rs6 billion will be distributed every year in girl students and the program will benefit more than 460,000 students. Also, it has been decided to include students of madrassas in the laptop scheme.
Chief Minister Shahbaz Sharif expressed these views at the Aiwan-e-Iqbal while distributing Khidmat card among the girl students. He said the aristocracy enjoyed all facilities but the poor people drastically needed even basic facilities. He said the aristocracy should stop opposition of the programmes aimed at the welfare and development of the common people.

Arrangements for upcoming National Book Fair enter final stage

The arrangements to organize the grand festival of National Book Fair in federal capital from April 22-24 have entered into final stages.
This was conveyed by the officials of National Book Foundation (NBF) during a meeting held here Wednesday to review arrangements of book fair.

Pakistan triples representation in list of Asia's best universities

LONDON: Pakistan has tripled its representation in the list of Asia’s best universities with seven Pakistani institutions in the top 300.


The Times Higher Education list for the latest Asia University Rankings 2017 shows that Pakistan has seven institutions in the top 300, five of which are new entrants.

In a first, Karachi's UIT students develop robotic legs model for the disabled

Three students of Usman Institute of Technology (UIT), Karachi have developed a model for wearable robotic legs, which will help disabled persons move and function on their own again.

“We have developed this exoskeleton model for paraplegics to assist them in the functions of sitting, standing and walking,” explained Moutasim Abbasi, who led the project. The other two students included Adil Hanif and Muhammad Usman.




The group, working under the supervision of Associate Professor Engineer Raza Jafri, exhibited their four months of hard work and research at the Pakistan Auto Parts Show (PAPS) held recently at Expo Centre, Karachi.

UET VC told to denotify appointments

LAHORE: The Higher Education Department (HED) has again directed the University Of Engineering and Technology vice chancellor to denotify the unlawful/irregular appointments of the registrar, deputy registrar and controller within the next seven days, rejecting its stance on the issue.

As a last effort, the UET administration through a letter No Univ/PS/Reg/21 of Jan 21 along with a report of the committee, had explained its point of view to prove that the appointments were made under the law. However, the explanation couldn’t satisfy the department.

HEC, French embassy celebrate cooperation

Islamabad-Higher Education Commission in collaboration with Embassy of France on Thursday celebrated ‘Pak-French Cooperation’ in higher education sector to strengthen the bilateral relations.

The Minister of State for Federal Education and Professional Training, Baligh-ur-Rehman, Dr Chairman HEC Mukhtar Ahmed, Ambassador of France to Pakistan Martine Dorance, attended the ceremony.