language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* date = January 12th 2021 11:44 am */
#ifndef CJ_OPENGL_H
#define CJ_OPENGL_H
struct SHADER_PROGRAM
{
u32 VS = {};
u32 FS = {};
u32 GS = {};
u32 shaderProgram = {};
char *shaderBuffer;
};
void CreateShader(SHADER_PROGRAM *s, char *inFilePath, i32 shader_type);
void LinkShaderProgram(SHADER_P... |
C | /*
* ModifyWordPack.c
* COMP 40 HW 4
* Rebecca Redelmeier & Darcy Hinck
* October 21, 2017
*
* Purpose: Gets and sets necessary variables in a word through calls to
* the bitpack interface
*/
#include "ModifyWordPack.h"
#include "bitpack.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
... |
C | #include "list.h"
#include <stdio.h>
#include <stdlib.h>
void createList(list* l)
{
*l = NULL;
}
void addElement(list* l, entryType item)
{
Node* newNode = (Node*)malloc(sizeof(Node));
newNode->info = item;
newNode->next = *l;
*l = newNode;
}
void createMap(Map* m)
{
*m = NULL;
}
void add... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* flag_management.c :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pressed_second_word.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include<string.h>
int main()
{
printf("1.To find the length of the string\n2.To concatenate two strings\n3.To find reverse of a string\n4.To copy one string to another string\n choose your option: ");
int option;
scanf("%d",&option);
char a[20],b[20];
... |
C | #pragma once
#include "glm\glm.hpp"
#include "GLUT\glut.h"
struct Col_Sphere
{
Col_Sphere(glm::vec3 pos, float rad) : position(pos), radius(rad) {}
glm::vec3 position;
float radius;
};
struct Col_AABB
{
Col_AABB(glm::vec3 pos, glm::vec3 ext) : position(pos), extent(ext) {}
glm::vec3 position;
glm... |
C |
#include<stdio.h>
#include "stdlib.h"
#include "string.h"
#include "linklist.h"
typedef struct _tag_LinkList
{
//棬ҪнڵϢҪһʼ
//Ǵͷڵ
LinkListNode header;
int length;
}TLinkList;
LinkList* LinkList_Create()
{
TLinkList *ret = (TLinkList *)malloc(sizeof(TLinkList));
if (ret == NULL)
{
return NULL;
}
//memset(re... |
C | #include <stdio.h>
int main()
{
char ch='a';
for( ;ch<='z';ch++)
{
printf(" %c",ch);
}
return 0;
} |
C | #include <stdio.h>
#define LINHAS 3
#define COLUNAS 5
//quando passa matriz para uma função, é obrigatório colocar as dimensões da matriz
void zeraMatriz(int m[LINHAS][COLUNAS]) {
int lin, col;
for(lin = 0; lin < LINHAS; lin++) {
for(col = 0; col < COLUNAS; col++) {
m[lin][col] = 0;
... |
C | #include <stdio.h>
#include <stdlib.h>
struct element
{
int width;
int height;
};
int main(int argc, char *argv[])
{
struct element *arr;
int count;
int i;
int w = 0, ind_h_max_main = 0, ind_h_max_secondary = 0;
int w_cur;
scanf("%d", &count);
arr = malloc(sizeof(struct element) *... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fill.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define CUSTOM_IMG_SIZE 1024*1024
int main()
{
FILE *streamIn =fopen("fruits.bmp","rb");
if(streamIn ==(FILE*)0)
printf("unable to open\n");
printf("x");
unsigned char header[54];
unsigned char colorTable[1024];
for(in... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
int main()
{
pid_t pid;
pid =fork();
if(pid == 0)
printf("Child process,pid = %d\n",pid);
else
printf("Parent process,pid =%d <-- This is PID of child process\n",pid);
exit(0);
}
|
C | #include <stdio.h>
#include <stdlib.h>
//Iteractive
int fib(int n)
{
int t0 = 0;
int t1 = 1;
int s = 0;
if(n<=1)
{
return n;
}
for(int i = 2; i<=n; i++)
{
s = t0+t1;
t0 = t1;
t1 = s;
}
return s;
}
//Recursion
int rfib(int n)
{
if(n<=1)
... |
C | /*------------------------------------------------------------------------------
show.c 920605 Separate compilation
-----------------------------------------------------------------------------*/
#include "always.h"
/* Here we include the headers for clusters being used (imported). */
/* Order may be important. ... |
C | #include <stdio.h>
void
__print_char(char c)
{
putchar(c);
}
void
__print_int(int num)
{
printf("%d", num);
}
|
C | /* Napisati funkciju void transponovana(int a[][max], int m, int n,
int b[][max]) koja određuje matricu b koja je dobijena
transponovanjem matrice a. Napisati program koji za učitanu matricu
celih brojeva 1 ispisuje odgvarajuću transponovanu matricu.
Pretpostaviti da je maksimalna dimenzija matrice 50 × 50. U slučaju
... |
C |
#include <cs50.h>
#include <math.h>
#include <stdio.h>
float get_input(void);
int main(void)
{
// ask from user
float dollars = get_input();
// list coins
int quarter = 25, dime = 10, nickel = 5, penny = 1;
// convert dollar value to cents
int cents = round(dollars * 100);
// divid... |
C | /*
This file contains the functions that will return the cost for taxi fare, lodging fees, parking fees,
and the conference fees as well as the allowed meals costs
*/
#include <stdio.h>
float TaxiFee () { //Prompts user for taxi fee as a float, and returns the given value once validated.
float fee;
p... |
C | #include<stdio.h>
#include<stdlib.h>
#include "lista.h"
int main(){
Lista* lista, *listaA, *listaB;
lista = cria();
listaA = cria();
listaB = cria();
lista = insere(lista, 9);
lista = insere(lista, 0);
lista = insere(lista, 7);
lista = insere(lista, 8);
lista = insere(lista, 0);
lista = insere(lista, 5);
... |
C | #include<stdio.h>
int main()
{
int n,k=1,a[10000],i;
a[0]=3;a[1]=4;
scanf("%d",&n);
for(i=0;i<n;i++)
{
a[++k]=(a[i]*10)+3;
a[++k]=(a[i]*10)+4;
}
for(i=0;i<n;i++)
printf("%d ",a[i]);
return 0;
}
|
C | #ifndef COLORS_H
#define COLORS_H
struct Color {
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char alpha;
};
#define COL_BK_GREY 32, 33, 36, 255
#define COL_WHITE 255, 255, 255, 255
#define COL_RED 255, 0, 0, 255
#define COL_GREEN 0, 255, 0, 255
#endif // COLORS_H
|
C | /*
** main.c for in /home/sahel/rendu/CPE/Rush
**
** Made by Sahel
** Login <sahel.lucas-saoudi@epitech.eu@epitech.net>
**
** Started on Fri Mar 3 22:01:31 2017 Sahel
** Last update Sun Mar 5 18:51:11 2017 Sahel
*/
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sy... |
C | /*
04-树6 Complete Binary Search Tree (30 分)
A Binary Search Tree (BST) is recursively defined as a binary
tree which has the following properties:
The left subtree of a node contains only nodes with keys less
than the node's key.The right subtree of a node contains only
nodes with keys greater than or equal to the ... |
C | #include <stdlib.h>
int oper8r(char *s1, char *op, char *s2)
{
int num1;
int num2;
int num3;
num1 = atoi(s1);
num2 = atoi(s2);
if (*op == '+')
num3 = num1 + num2;
if (*op == '-')
num3 = num1 - num2;
if (*op == '*')
num3 = num1 * num2;
if (*op == '/')
num3 = num1 / num2;
if (*op == '%')
num3 = n... |
C | /* EU NAO USO PUTS*/
#include <stdio.h>
void primo(int a, int b) {
int i;
for (i = 0; i < 10; i++) {
a = a+i;
}
printf ("NUMERO DO SWAG DO KEVIN %d", a *10*b);
}
void soma (int a, int b) {
int r = a + b;
printf ("SOma = %d\n",r);
}
void sub(int a, int b) {
int r = a - b;... |
C | /**************************************
* bubble sort method
**************************************/
#define TRUE 1
#define FALSE 0
typedef int BOOL;
void bubble_sort (int O_arr[], int num)
{
int i, j;
BOOL changed = TRUE;
for (i = 0; i < num - 1 && changed; i ++)
{
changed = FALSE;
for (j = 0; j < num ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <mpi.h>
#define MAXLINE 400
int getFileLines(FILE *Fin) {
//Find lines of file
int ch;
int l=0;
while(!feof(Fin)) {
ch = fgetc(Fin);
if(ch == '\n') {
l++;
}
}
return l;
}
int main(int argc,char **a... |
C | #include <stdio.h>
#include <fcntl.h>
#include <sys/time.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
int main(int argc, char **argv) {
int fd;
struct stat sbuf;
struct timeval tv[2];
if (argc < 2) {
fprintf(stderr, "Usage: %s <pathname> ... |
C | /* this program computes pi using the rectangle rule */
#include <stdio.h>
#define INTERVALS 1000000
int main(int argc,char *argv[]){
double area,ysum,xi;
int i;
ysum=0.0;
for(i=0;i<INTERVALS;i++){
xi=(1.0/INTERVALS)*(i+0.5);
ysum += 4.0/(1.0+xi*xi);
}
area=ysum *(1.0/INTERVALS);
printf("Area ... |
C | /*
* Copyright (c) 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)maketape.c 1.1 (2.10BSD Berkeley) 12/1/86
* (2.11BSD Contel) 4/20/91
* TU81s didn't like open/close/write at 160... |
C | #include<stdio.h>
#include<stdlib.h>
float**initial(int row, int col)
{
float **a,*b,x=0;
int i,flag=1;
a = (float **) malloc(row * sizeof(float *)); //r rows
for(i = flag-1; i < col; i++)
{ if(x==0)
{
b = (float*)malloc(col*sizeof(float));
a[i]=b; //cols for i th row
}
}
return a;
}
float**mova(flo... |
C | #include <stdio.h>
#include <stdint.h>
void secret(uint8_t *to, uint8_t *from, size_t count) {
static const void *labels[] = { &&c0, &&c1, &&c2, &&c3, &&c4, &&c5, &&c6, &&c7 };
size_t n = (count + 7) / 8;
size_t m = count % 8;
int b;
goto *labels[m];
c0: *to++ = *from++;
c7: *to++ = *from++;
c6: *to++ = *fro... |
C | #include <stdio.h>
#include <stdlib.h>
void funcao_tamanho(int *vector,int size, int *tam,int aux,int i);
int main(){
int size,*vector,i,tam=0;
scanf("%d",&size);
vector = (int *) malloc(size*(sizeof(int)));
for(i=0;i<size;i++){
scanf("%d",&vector[i]);
}
funcao_tamanho(vector,size,&... |
C | #include <math.h>
double get_current_velocity(void);
double get_current_braking_force(void);
double get_current_accel_force(void);
void throw_velocity_exception(void);
const double maxVehicleVelocityAllowed = 58.1152; //58.1152m/s = 130 mph
const double vehicleMass = 1000; //in kg
const double timeStep = .001; //1 ms... |
C | #include "audio.h"
snd_pcm_t* audio_init(const char *name, int isPlayback, int n_channels, snd_pcm_uframes_t *frames, unsigned int *sample_rate)
{
int err;
snd_pcm_hw_params_t *hw_params;
snd_pcm_t *capture_handle;
snd_pcm_stream_t stream_type = SND_PCM_STREAM_CAPTURE;
if(isPlayback)
{
stream_type = SND... |
C | #include <stdio.h>
int swap(int a,int b){
int c;
c = a;
a = b;
b = c;
}
int swap1(int a,int b){
int c;
c = a;
a = 23;
b = 22;
}
int swap2(int *a,int *b){
*a = 23;
*b = 22;
}
int swap3(int *a,int *b){
int c;
c = *a;
*a = *b;
*b = c;
}
int swap4(int *a,int *b){
*a = *b + *a;
*b = *a - *b;
*a = *a -... |
C | /*
* SOMO_control.c
*
* Created: 24-05-2021 10:59:07
* Author: mariu
*/
#include "uart_int.h"
#define CMDLEN 8
#define SELECT 0x03
#define PLAY 0x0D
void sendCommand(const char* arr)
{
for(unsigned char i = 0; i < CMDLEN; i++)
{
SendChar(*arr);
arr++;
}
}
void initSomo()
{
InitUART(9600, 8, 0);
}
void... |
C | #include <stdio.h>
void print_matrix(int[][3],int,int);
int main(void)
{
int array [][3] = {{7,8,9},{10,11,12},{13,14,15}};
print_matrix(array,3,3);
return 0;
}
void print_matrix(int array[][3],int row_size, int column_size)
{
int i,j;
for (i=0; i<row_size; i++)
{
for(j=... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <stdint.h>
#include <unistd.h>
#include <inttypes.h>
#include <openssl/md5.h>
void init(void){
struct timeval time;
gettimeofday(&time, NULL);
srand((time.tv_sec * 1000000) + (time.tv_usec));
}
void shell(void){
execve("/b... |
C |
#ifndef MAP_H
#define MAP_H
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
struct map_node;
typedef struct map_node map_node;
typedef struct
{
map_node **buckets;//nodelist
unsigned nbuckets, nnodes; //num_ele, tot_ele
} map_base;
typedef struct
{
unsigned bucketidx;
map_node *node;
} map_i... |
C | //Accept strings from user and display counts of vowels in string.
#include<stdio.h>
int main()
{
char string[10];
int i=0, count=0;
printf("Enter the string: ");
//scanf("%s", str);
gets(string);
printf("\nString is: %s", string);
while (string[i] != "\0")
{
if (string[i] == "a" || stri... |
C | #include <stdlib.h>
#include <stdio.h>
#include "access_closed.h"
static void initialize_array(FILE* ptr_arr[], int length) {
int i;
FILE** ptr = ptr_arr;
for(i = 0; i < length; i++, ptr++) {
*ptr = fopen("file.txt","r");
}
}
static void close_backwards(FILE** ptr, int to_close) {
int i;
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/socket.h>
#include<linux/in.h>
#include<pthread.h>
#define MAXLINE 4096
#define SERV_PORT 3006
#define LISTENQ 8
void fileTransfer(int newfd)
{
char buf_recv[100], buf_send[100];
char fbuffer[1000], filebuffer[1000];
char nbytes, len;
FILE *fp;
... |
C | //Various data structures required for the finite state machine
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX_TABLE_ENTRIES 256
#define MAX_STATE_NAME_SIZE 32
#define MAX_FSM_NAME_SIZE 128
enum Final_state{
//bools for final state
fsm_false,
fsm_true
};
struct tt_entry{
//transition t... |
C | #include <sys/types.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
void isExists(int pid){
int rc = kill(pid, 0);
if (rc != 0) {
switch (errno) {
case EINVAL: // 22
printf("An invalid signal was specified.\n");
break;
ca... |
C | #include "monty.h"
/**
* pchar - Instruction that prints a char.
* @stack: stacker of a doubly linked list
* @line_number: Number line
*/
void pchar(stack_t **stack, unsigned int line_number)
{
if (!stack || !*stack)
{
print_error(line_number, "can't pchar, stack empty");
return;
}
if ((*stack)->n < 0 || (*... |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <malloc.h>
#include <mem.h>
#include "longCalculation.h"
void testPlus(){
int result=1;
char osn[] = "10000";
char *end;
int base =strtol(osn,&end,10);
int flag = 1;
char *chA;
char nameInp[] = "C:\\Users\\LEGION\\CLionProje... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parser_utils_nodes.c :+: :+: :+: ... |
C | /*
* MIT License
*
* Copyright (c) 2020 Nicholas Fraser
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, ... |
C | /* setdev.c - setdev */
#include <conf.h>
#include <kernel.h>
#include <proc.h>
extern long ctr1000;
extern int currpid;
extern int allpids[NPROC];
/*------------------------------------------------------------------------
* setdev - set the two device entries in the process table entry
*-----------------------... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <windows.h>
#include "menu.h"
#include "arv.h"
#include "prof.h"
void depto_cadastro(Inst* arv){
char depNome[51], depSigla[11];
int verificacaoDep=0;
system("cls");
printf("====================================");
... |
C | // Pick random values
#include <time.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/types.h>
#define PACKAGE "raval"
#define VERSION "0.0.1"
/* status epilepticus, print help and exit wit... |
C | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <limits.h>
#include <stdint.h>
#include <time.h>
#include <getopt.h>
#include "ext2_fs.h"
int fd;
struct ext2_super_block superblock;
struct ext2_group_desc desc_g;
struct ext2_dir_entry dir_en... |
C | /*
Problem statement :
Accept string from user and copy the conetents into another string using pointer.
Implement strcpy.
*/
#include<stdio.h>
void CopyStr(char *Src,char *Dest)
{
while(*Src != '\0')
{
*Dest = *Src;
*Src++;
*Dest++;
}
*Dest = '\0';
}
int ma... |
C | #include <cs50.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
bool keyValidation(string key, int keyLength);
string encryptText(string plainText, string key);
int main(int argc, string argv[])
{
// Check if the user has passed the key arg. or not.
if (argc != 2)
{
printf("Usage : ./... |
C | #include "synchronization.h"
#include <pthread.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
static void critical_zone(){
int t = rand()%5 + 1;
sleep(t);
}
static void * thread_work(void* data){
while(1){
int t = rand()%3 + 1;
sleep(t);
int choice = rand()%100;
if(choice... |
C | #ifndef _LOCK_H_
#define _LOCK_H_
//#define DBG_PRINT /* Control if the system should Print out */
/* debug statements */
#define NLOCK 50 /* Number of R/W Locks */
#define DELETED -6 /* Lock has been deleted */
#define INIT 0 /* Lock is initialized but unused */
#define FREE 1 /* Loc... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(){
int i, j, k;
int tf[1010], tr[1010], deadline[1010], aux_tf, aux_tr, aux_mud;
char num[10];
char fcfs[50], srtn[50], rr[50];
char s[50], ss[50], sss[50], en[50];
int trace[] = {1, 2, 5, 10, 20, 50, 100... |
C | #include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
void gen(int n, unsigned char *s, size_t *len)
{
*len = n * 7 + 4;
s[0] = 0xff;
for (int i = 1; i < *len; ++i)
{
s[i] = s[i-1] - 1;
}
}
|
C | #include <stdio.h>
#include <string.h>
#include "test.h"
#include "libfts.h"
static void print_array(FILE* stream, void* s, size_t bytes);
void* ft_memcpy(void* dst, const void* src, size_t n);
int memcpy_test_input_validation_null_dest()
{
ft_memcpy(NULL, (void*)1, 0);
return 0;
}
int memcpy_test_input_validation... |
C | //Program to find greater of 3 numbers
//study of else if statement
//refer : conditional branching.txt
//see : else if.png
#include<stdio.h>
int main()
{
int n1,n2,n3;
printf("\n Enter 3 numbers ");
scanf("%d%d%d", &n1,&n2,&n3);
if(n1 == n2 && n1 == n3)
printf("\n All numbers are %d... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | /*
- Questão 4.12 -
*/
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
int i, soma;
soma = 0;
system( "chcp 65001 > NUL" );
for ( i = 2; i <= 30; i += 2 )
soma += i;
printf( "Soma = %d\n", soma );
system( "pause" );
return 0;
} /* fim [main] */
|
C | #include <stdio.h>
#include <ctype.h>
#include <string.h>
#define NKEYS (sizeof(keytab)/sizeof(keytab[0]))
#define MAXWORD 100
struct key {
char *word;
int count;
} keytab[] = {
"auto",0,
"break", 0,
"case", 0,
"char", 0,
"const", 0,
"continue", 0,
"default", 0,
"unsigned", 0,
"void", 0,
"volatite", 0... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* piecechooser.c :+: :+: :+: ... |
C | /*Naresh i Technologies For Any Doubts contact Mr.Balu Email:balu.bhig@gmail.com */
void main()
{
int i=100;
char ch='A';
float f=16.8;
void *ptr;
ptr=(int*)&i;
printf("\n%d %d",i,*(int*)ptr);
/*Naresh i Technologies For Any Doubts contact Mr.Balu Email:balu.bhig@gmail.com */
ptr=(char*)&ch;
... |
C | #include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
void main(){
int currentState = 1,len;
char a,b,str[100];
printf("Enter your string : ");
scanf("%s",&str);
len = strlen(str);
if(len==3){
if(currentState == 1 && str[0]=='a'){
currentState = 2;
... |
C | //3. Seten (respektive vynsoben) sel
//Na vstupu je posloupnost sel oddlench mezerami. Pomoc dlouh aritmetiky naprogramujte:
//a) souet celch sel
//b) souin celch sel
//c) souet relnch sel
//d) souin relnch sel
#include <stdio.h>
#include <string.h>
#include "aritmetika.h"
void main(int argc, char** argv)
{
Cisl... |
C | #define OBMPIMAGENAME "bmp_encrypt.bmp"
#define OOBMPIMAGENAME "bmp_decrypt.bmp"
#define CSVNAME "output.csv"
#define BYTE_MAX_VALUE 256
#define BIT_BYTE 8
#include <stdio.h>
#include <time.h>
#include "SPN.h"
int user_input(char* filename, unsigned int data_length, unsigned int rounds_count){
/*some exception ... |
C | #include "LRReceiver.H"
// C++ headers
#include <sstream> // for istringstream
#include <iostream> // for cin, cout, cerr
#include <iomanip> // for setw, left
#include <cstdio> // for perror
#include <cerrno> // for perror
// Unix headers
#include <unistd.h> // for read
// Local headers
#include "Socket... |
C | /*8
ݣеввԳ
3˼
1̬(̬)
ڵǰ˳ͶУʹþ̬Ԫأһ˳ֻܴMAXLENԪء
Ϊ˴ŸԪأҪܹԴſռչΪʵһĿ꣬ǿʹö̬Ԫء
ʱ˳ݽṹͿԶ£ */
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
typedef struct
{
int* elem; // ָűԪصĶ̬ռ
int size; // ̬ռĴС
int n; // һ¼ʵʴŵԪصĸ
} intVec;
// /*... |
C | #include <stdlib.h>
#include <string.h>
char* printerError(char *s) {
int numErrors = 0;
int count = 0;
char *frac = malloc(sizeof(char));
for(; *s; s++,count++)
if(*s < 97 || *s > 109)
numErrors++;
sprintf(frac,"%d/%d",numErrors,count);
return frac;
}
|
C | #include "splines.h"
#include <math.h>
void spline(int n, double *x, double *y, double *b, double *c, double *d) {
int i, ib, nm1;
double t;
nm1 = n - 1;
if (n < 2) return;
if (n < 3) goto l20;
d[1] = x[2] - x[1];
c[2] = (y[2] - y[1]) / d[1];
for (i = 2; i <= nm1; i++) {
d[i] = x[i + 1] - x[i];
... |
C | /* Author: josiahlee
* Partner(s) Name:
* Lab Section:
* Assignment: Final Project
* Exercise Description: [optional - include for your own benefit]
*
* I acknowledge all content contained herein, excluding template or example
* code, is my own original work.
*/
#include <stdlib.h>
#include <stdbool.h>
#incl... |
C | # include<stdio.h>
int main(){
int a=4;
float b =2.56;
char c='u';
int d=34;
int e=5+5;
printf ("The value is a is of a %c %f \n" , c,b);
printf ("The value is a is of a %d \n" ,a);
printf ("The value is a is of a %d \n" ,a);
printf ("sum value o... |
C | #include <stdio.h>
int N;
int arr[10000];
int main(void)
{
scanf("%d", &N);
for (int i = 0; i < N; i++)
scanf("%d", &arr[i]);
for(int i = 0; i < N; i++)
{
for(int j = 0; j < i; j++)
{
int temp;
if(arr[i] < arr[j])
{
temp = arr[i];
... |
C | #include "merge.h"
#include <stdlib.h>
int *merge(int *vec1, int n1, int *vec2, int n2) {
int i1 = 0; // current location in vec1
int i2 = 0; // current location in vec2
int i3 = 0; // current location in the resulting array
int *vec3 = malloc((n1 + n2) * sizeof(int));
while (i1 < n1 &... |
C | #include<stdio.h>
int main()
{
int N,L,A[51],i,j,k,t,x,s;
scanf("%d",&N);
for(i=0;i<N;i++)
{
scanf("%d",&L);
for(j=0;j<L;j++) scanf("%d",&A[j]);
s=0;
for(k=0;k<(L-1);k++)
for(x=k+1;x<L;x++) if(A[k]>A[x]) {t=A[k];A[k]=A[x];A[x]=t;s++;}
printf("Optimal train swapp... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
void printCharacter(char *src, int start_at) {
//int i = 0;
//char tmp_src[MAX_CHARACTER];
if (src[start_at] == '\0') {
//return '\0';
printf("%s\n",src);
}
//strncpy(tmp_src,(src + 1), strlen(src) - 1);
switch (src[start_at] ) {
case '2':
s... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_convert_c.c :+: :+: :+: ... |
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int YangShi(int num[][3],int x,int y,int number){
int i = 0, j = y-1;
while (i<x&&y>=0){
if (number > num[i][j]){
i++;
}
else if (number < num[i][j]){
j--;
}
else{
return 1;
}
}
return 0;
}
int main(){
int num[3][3] = { { 1, ... |
C | #include<stdio.h>
int main()
{
int n1,n2,min;
min=(n1<n2) ? n1:n2;
while(1)
{
if(min%n1==0 && min%n2==0)
{
printf("lcm of %d and %d=%d\n",n1,n2,min);
break;
}
++min;
}
return 0;
}
|
C | #include "fun.h"
#include "conio.h"
#include "string.h"
int compareString (char *string1, char *string2)
{
if (!string1 && !string2) return 0;
if ( string1 && !string2) return 1;
if (!string1 && string2) return -1;
for (; *string1 && *string2 && *string1 == *string2; string1++, string2++) {}
ret... |
C | #include<stdio.h>
main()
{
char string[]="Hello World";
display(string);
}
void display(char *string)
{
printf("%s",string);
}
|
C | #include <stdio.h>
#include <stdlib.h>
void bubbleSort(int arr[], int size)
{
for (int i = 0; i < size - 1; ++i) //perform the loop size-1 times
{
for (int j = 0; j < size - i - 1; ++j) // j<size-i-1 since last i elements are sorted already
{
if (arr[j] > arr[j + 1]) ... |
C | #include <stdlib.h>
#include <stdio.h>
int main() {
// a_size is the size of the dynamic array to create
int a_size = 10;
// a is an integer pointer initialised to NULl
int *a = NULL;
// allocate enough memory for a_size integers
a = malloc(a_size * sizeof(int));
// if the return from malloc is NULL, an error
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <malloc.h>
void sortiranje(int *polje, int pocetni, int zadnji)
{
int i, min = pocetni, tmp;
if (pocetni < zadnji)
{
for (i = pocetni + 1; i<zadnji; i++)
{
if (polje[i]<polje[min])
min = i;
}
tmp = polje[pocetni];
polje[pocetni] = po... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
#define MY_KEY 19920809
#define SHM_SIZE 0x1000
void toggleCase(char *buf,int cnt);
void toggleCase(char *buf,int cnt)
{
int i;
for(i=0;i<cnt;i++)
{
if((buf[i] >= 'A') && (buf[i] <= 'Z'))
... |
C | #include <stdio.h>
#include <string.h>
#include <assert.h>
int str_del_sub(char* str1,char* str2);
int main()
{
char str2[] = {"cd"};
char str1[] = {"abcdabcda"};
printf("str1 = %p\n",str1);
printf("str2 = %p\n",str2);
printf("%s\n",str1);
str_del_sub(str1,str2);
printf("str1 : %s\... |
C | #include <stdio.h>
#include <stdlib.h>
#include "mat.h"
#define MAT_SIZE 5
int test_unoptimized(double *a, int arows, int acols,
double *b, int brows, int bcols,
double *c_actual) {
double *c_calc = malloc(MAT_SIZE * MAT_SIZE * sizeof(double));
mmult(c_calc, a, MAT_... |
C | typedef struct {
// in ms
double attack_time;
double attack_gain;
double decay_time;
double decay_gain;
double sustain_time;
double release_time;
} adsr_param;
long gain(float* in, size_t buflen, size_t offset, size_t len, double gain)
{
ASSERT(buflen >= offset + len, "offset + len greater that buffer ... |
C | //programname: e2-22.c
#include <stdio.h>
int main(void) {
int a, b;
int *p;
a = 100;
p = &a;
b = *p;
printf("aの値 = %d\t aのアドレス%x\n", a, &a);
printf("bの値 = %d\t bのアドレス%x\n", b, &b);
printf("pの値 = %x\t pのアドレス%x\n", p, &p);
return 0;
} |
C | /*
** time_utils.c for zappy in /home/pumpkin/Epitech/PSU_2015_zappy/server/src
**
** Made by Loik Gaonach
** Login <gaonac_l@epitech.net>
**
** Started on Thu Jun 23 17:15:00 2016 Loik Gaonach
** Last update Thu Jun 23 17:15:00 2016 Loik Gaonach
*/
#include <stddef.h>
#include "time_utils.h"
unsigned long diff... |
C | #include "holberton.h"
/**
* rev_string - reverse string
* Description:reverse string
* @s:string to print
*/
void rev_string(char *s)
{
int string = 0;
int index = 0;
char tmp;
while (s[string] != '\0')
{
string++;
}
string--;
while (index < string)
{
tmp = s[index];
s[index] = s[string];
s[stri... |
C | #include<stdio.h>
main()
{
int a[9],s=0;
float avg;
printf("enter 10 no to avaerage it ==>>\n");
for(int i=0;i<=9;i++)
scanf("%d",&a[i]);
for(int i=0;i<=9;i++)
s=s+a[i];
avg=s/10.0;
printf("%f",avg);
} |
C | #include "holberton.h"
#include <stdio.h>
/**
* _strlen - Count the length of a string.
* @s: String.
* Return: Length.
*/
unsigned int _strlen(char *s)
{
unsigned int c;
for (c = 0; s[c]; c++)
;
return (c);
}
/**
* str_concat - Concatenates two strings
* @s1: First string.
* @s2: Second string.
* Ret... |
C | #include "vandmlib.h"
#include <stdio.h>
#include <math.h>
void print_v4(vec4 v)
{
printf("[ %f %f %f %f ]\n", v.x, v.y, v.z, v.w);
}
vec4 scalar_mult_v4(float s, vec4 v)
{
return (vec4){v.x * s, v.y * s, v.z * s, v.w * s};
}
vec4 v4_add_v4(vec4 a, vec4 b)
{
return (vec4){a.x + b.x, a.y + b.y, a.z + b.z,... |
C | /*****************************************************************************
* Copyright 2005 Daniel Ferullo *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* y... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.