C / C++ Code Portfolio


else if (pOld == NULL) { return



Download 112,15 Kb.
bet7/30
Sana01.03.2022
Hajmi112,15 Kb.
#475852
1   2   3   4   5   6   7   8   9   10   ...   30
Bog'liq
dddd

else if (pOld == NULL)
{
return(newAllocatedPointer);
}
//otherwise, copy data from the pOld into the newly allocated memory
else
{
unsigned char *newAllocatedPointerStart = newAllocatedPointer, *pOldChar = pOld;
if (newSize > oldSize)
{
for (*newAllocatedPointer = *pOldChar;
(size_t)(newAllocatedPointer - newAllocatedPointerStart) < oldSize;)
{
*newAllocatedPointer++ = *pOldChar++;
}
}
else
{
for (*newAllocatedPointer = *pOldChar;
(size_t)(newAllocatedPointer - newAllocatedPointerStart) < newSize;)
{
*newAllocatedPointer++ = *pOldChar++;
}
}
free(pOld);
// return the location of the newly allocated memory
return(newAllocatedPointerStart);
}
}
}
Function Pointers
// This file contains the following functions:
// GetPrintfPointer() returns a pointer to the C library function printf()
// GetPutsPointer() returns a pointer to the C library function puts()

#include



int (*GetPrintfPointer(void))(const char *format, ...)
{
// initialize a pointer to function returning int and set to function printf()
int (*ptrToPrintf)(const char *format, ...) = printf;
return(ptrToPrintf);
}

int (*GetPutsPointer(void))(const char *str)
{
// initialize a pointer to function returning int and set to function puts()
int (*ptrToPuts)(const char *str) = puts;
return(ptrToPuts);
}
// This file contains the following three functions:
// Compare() - uses C library function strcmp() to compare two strings from a ragged string array
// SortStudents() - uses qsort() to sort an array of strings using Compare()
// DisplayClassStatus() - uses bsearch() to find attendees who weren't registered, and registered students
// who did not attend, and prints that list.

#include


#include
#include


Download 112,15 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   10   ...   30




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish