answersLogoWhite

0

d.j. erving

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

What are the application of this pointer can you use this pointer in friend function justify?

The this pointer can only be used within nonstatic member functions. Friend functions are not members so they have no access to a this pointer. However, you can pass a specific instance of a class to a function via a class reference argument. To understand how friendship works, first understand that a nonstatic member function has the following properties: 1. It has private access to the class. 2. It is scoped to the class. 3. It must be invoked upon an object of the class (has a this pointer). Static member functions have the first two properties while friend functions only have the first property.


How do you do to shoot a 3 pointer?

well its easy for me but not for some people who arent as cool as me, all you do is act like you're shooting a free throw or a shot like that, but you throw it harder if you're weak then you should start working out you'll be able to shoot one soon' good luck being as good as me (it's hard to do so dont waste your time) see ya!


Write a c program to insert an element in the beginning at the end at the specified position in a linear linked list?

#include<stdio.h> #include<stdlib.h> typedef struct Node { int data; struct Node *next; }node; void insert(node *pointer, int data) { /* Iterate through the list till we encounter the last node.*/ while(pointer->next!=NULL) { pointer = pointer -> next; } /* Allocate memory for the new node and put data in it.*/ pointer->next = (node *)malloc(sizeof(node)); pointer = pointer->next; pointer->data = data; pointer->next = NULL; } int find(node *pointer, int key) { pointer = pointer -> next; //First node is dummy node. /* Iterate through the entire linked list and search for the key. */ while(pointer!=NULL) { if(pointer->data == key) //key is found. { return 1; } pointer = pointer -> next;//Search in the next node. } /*Key is not found */ return 0; } void delete(node *pointer, int data) { /* Go to the node for which the node next to it has to be deleted */ while(pointer->next!=NULL && (pointer->next)->data != data) { pointer = pointer -> next; } if(pointer->next==NULL) { printf("Element %d is not present in the list\n",data); return; } /* Now pointer points to a node and the node next to it has to be removed */ node *temp; temp = pointer -> next; /*temp points to the node which has to be removed*/ pointer->next = temp->next; /*We removed the node which is next to the pointer (which is also temp) */ free(temp); /* Beacuse we deleted the node, we no longer require the memory used for it . free() will deallocate the memory. */ return; } void print(node *pointer) { if(pointer==NULL) { return; } printf("%d ",pointer->data); print(pointer->next); } int main() { /* start always points to the first node of the linked list. temp is used to point to the last node of the linked list.*/ node *start,*temp; start = (node *)malloc(sizeof(node)); temp = start; temp -> next = NULL; /* Here in this code, we take the first node as a dummy node. The first node does not contain data, but it used because to avoid handling special cases in insert and delete functions. */ printf("1. Insert\n"); printf("2. Delete\n"); printf("3. Print\n"); printf("4. Find\n"); while(1) { int query; scanf("%d",&query); if(query==1) { int data; scanf("%d",&data); insert(start,data); } else if(query==2) { int data; scanf("%d",&data); delete(start,data); } else if(query==3) { printf("The list is "); print(start->next); printf("\n"); } else if(query==4) { int data; scanf("%d",&data); int status = find(start,data); if(status) { printf("Element Found\n"); } else { printf("Element Not Found\n"); } } } }


Explain pointer of any data type that requires four bytes?

When a pointer to a data type that requires four bytes is declared, the compiler knows that the target object is four bytes in size. When the program then performs a calculation to offset the pointer, such as to add 3 (for instance) to the pointer, the generated code actually adds 12. This is because the compiler assumes that adding or subtracting numbers to or from a pointer is an attempt to use the pointer in an array context. (Actually, this behavior is defined in the language specification.)The other valid arithmetic manipulation of a pointer is subtraction of two pointers to the same type of object. In this case, again, an internal multiplier of 4 is applied, and the result is an offset that could be used if the first pointer were the base of an array of those objects.The size of the target object could be any value, such as a double which might be 8 bytes. The compiler will do the arithmetic correctly.Also, keep in mind the distinction between the size of the pointer and the size of the object to which the pointer points. This answer assumes the latter.In any case, the programmer must insure that the calculation results in a pointer or offset value that represents an address in the base object array, assuming that the allocated space of that object is correct. Any other result is inconsistent with the defined usage of a pointer, and the result of dereferencing such an inconsistent pointer or offset is undefined by the language specification, and could result in corruption, incorrect behavior, or crash.


How many bytes are required to store the pointer?

It depends on the platform... In a 16 bit environment, such as DOS or Windows 3.x, a near pointer is two bytes, while a far pointer is 4 bytes. In a 32 bit environment, such as Win32, a pointer is 4 bytes. In a 64 bit environment, such as Win64, a pointer is 8 bytes. If you want to find out in your particular environment, look at sizeof(ptr), where ptr is declared as a pointer to something. char* ptr; std::cout << sizeof(ptr) << std::endl; Note that the size of the pointer is not the same as the size of the object to which it points. If you looked at sizeof(*ptr), you would get 1.

Related Questions

How many points do you score for a basket?

It all depends on where you shoot from. If you shoot anywhere inside the 3 pointer line during play, it will be counted as a 2 pointer. However, if you shoot outside of the 3 pointer line, then its counted as a 3 pointer. If you are fouled and get the shot in from the free throw line, you get 1 point.


What does the range mean in basketball?

How far a person can shoot the ball into the basket. For example: "Lebron just dunked on that n1gg3r, and then he sunk a 3-pointer." He has range because he can score inside, as well as outside.


How long is a 3 pointer?

depending from where you shoot from the court. its either 18/19 from the side and 25+ from centre court


Why are there 2 half circles close together on college basketball courts?

This is because some have the college 3 pointer AND the Pro 3 pointer.


How do you make threes in basketball?

If you mean litterly then you cant make threes. If you mean a 3 pointer then you stand on the 3 point line and shoot the ball in the basketball hoop!!


What year was the first 3 pointer shot?

July 26 1864


How many points do you get for a long range shot in basketball?

a two point shot is anything inside the 3 point line. anything outside the 3 point line is a you guessed it a three pointer ,and if you shoot from behind the half court line its a 4 pointer


What is it called when you make a shot behind the arc in NBA?

a threee pointer


Who sank the first 3 pointer in collage basketball and what year?

cade- 2005


First nba 3 pointer in all-star game?

Scotty Pipen


What year did Ronnie sink the first 3 pointer?

November 29, 1980


When do you have to take the ball back behind the foul line in a basketball?

When you get fouled within the 3 point line you shoot 2 shots behind the free throw line. If you get fouled on a 3 pointer you get 3.