Skip to main content

Posts

Showing posts with the label Memory

How to Restore the Original Storage Capacity of Pen Drive

                      I n the following post we will see how to restore the actual storage capacity of your pen drive. Sometimes it happens that your pen drive show smaller storage capacity than original storage capacity. For example If you have a 8 GB pen drive which has original storage capacity of 7.18 GB but now it is showing total space 4.32 GB. Usually it happens when you make your pen drive bootable for linux or other Operating Systems or your pen drive got older. To get back your pen drive with original storage capacity you need to do following things: 1) Mount your pen drive into windows operating system 2) Open cmd as administrator 3) Execute following command in the cmd C:\\Windows\System32>diskpart your cmd will change C:\\Windows\System32> to DISKPART> Now type the below command: DISKPART>list disk It gives the list of all disk parti...

Dynamic memory allocation using malloc in C

If you are a beginner in programming it may be that you got some trouble to define an array of large size.As if you are trying to allocate an array of size (10^7===10000000) like                                       int a[10000000]; you must got an run time error called segmentation fault.To overcome these difficulties we use a malloc function to declare a run time memory. First we have to include header file "malloc.h" and then the following lines of codes. #include<malloc.h> int main() {      int *a;      a=(int *)malloc(sizeof(int)*10000000);  //equivalent to int a[10000000] without segmentation fault } If you want to declare a two dimensional array like.... int a[m][n]; Where m and n are very large number then write the following lines of codes. int main() {      int **a,i;      a=(int **)mall...