language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | //Write a C program to check if the number of 3's is greater than the number of 5's in array of length 10.
#include<stdio.h>
#define SIZE 10 //Size if Fixed
void check_condition(int three,int five) //check the number of fives greter,or smaller,or equal
{
if(three == five) //check it equal or not
{
printf... |
C | #include"HashBucket.h"
void Test()
{
HashBucket hashbucket;
//初始化
InitHashBucket(&hashbucket);
//插入
InsertHashBucket(&hashbucket, 5);
InsertHashBucket(&hashbucket, 12);
InsertHashBucket(&hashbucket, 2);
InsertHashBucket(&hashbucket, 6);
InsertHashBucket(&hashbucket, 22);
InsertHashBucket(&hashbu... |
C | #include<stdio.h>
#include<unistd.h>
#include<signal.h>
int main()
{
pid_t cpid = fork();
if (cpid ==0)
{
while(1)
{
printf("child in a loop\n");
sleep(1);
}
}
else
{
sleep(5);
kill(cpid,SIGINT);
printf("child killed by parent...\n");
_exit(0);
}
return 0;
}
|
C | #include<stdio.h>
#include<malloc.h>
struct node{
int data;
struct node *left, *right;
};
struct node *root=NULL;
void insert(struct node *ptr)
{
int x,i,j;
printf("enter element: ");
scanf("%d",&x);
struct node *ptr2=(struct node*)malloc(sizeof(struct node));
ptr2->data=x;
ptr2->left=NULL;
ptr2... |
C | #include "FTP.h"
int ftpConnect(ftp* ftp, const char* ip, int port) {
int socketfd;
char rd[1024];
socketfd = connectSocket(ip, port);
ftp->control_socket_fd = socketfd;
ftp->data_socket_fd = 0;
ftpRead(ftp, rd, sizeof(rd));
return 0;
}
static int connectSocket(const char* ip, int port) {
int sockfd;
st... |
C | #include <stdio.h>
int main(void)
{
int n1, d1, n2, d2, n_res, d_res;
char operator;
printf("Enter two fractions separated by +, -, * or /: ");
scanf("%d /%d %c %d /%d", &n1, &d1, &operator, &n2, &d2);
switch (operator) {
case '+':
n_res= n1 * d2 + n2 * d1;
d_res= ... |
C | #ifndef PRIORITYQUEUE_H_
#define PRIORITYQUEUE_H_
#include <stdio.h>
#include <stdlib.h>
#include "heap.h"
typedef void* KEY_TYPE;
typedef void* VALUE_TYPE;
typedef struct PriorityQueue PriorityQueue;
struct PriorityQueue{
Heap *heap;
};
PriorityQueue* priorityqueue_constructor( int (*priority_queue_compare_functi... |
C | #include <stdio.h>
#include <ctype.h>
/*
The program examines each character from the standart input until reaching EOF
The program is keeping track whether the currnt char is at a beginning of a sentance, at a middle of a sentane, or inside a quotation marks, and deals with the current character accordingly.
*/
enum... |
C | /**
* C program to print the given number pattern
*/
#include <stdio.h>
int main()
{
int num;
printf("Enter any number: ");
scanf("%d", &num);
while(num != 0)
{
printf("%d\n", num);
num = num / 10;
}
return 0;
}
Outpu |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_instruction.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<string.h> //strlen
#include<stdlib.h> //strlen
#include<sys/socket.h>
#include<arpa/inet.h> //inet_addr
#include<unistd.h> //write
#include<pthread.h> //for threading , link with lpthread
clock_t start , end ;
//the thread function
void *client_connection(void *);
int main(int a... |
C | /************************************************************************
* Name: Rohan Sharma *
* Login: rsharma1 *
* Student Number: 639271 *
* COMP30023 Computer Sy... |
C | /*
* =====================================================================================
*
* Filename: hello.c
*
* Description: simple kernel module
*
* Version: 1.0
* Created: 09.02.2021 23:24:29
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (), ... |
C | //
// Sorts a list using multiple threads
//
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#define MAX_THREADS 65536
#define MAX_LIST_SIZE 300000000
#define DEBUG 0
// Thread variables
//
// VS: ... declare thread variables, mutexes, condit... |
C | /**
@file base_api.c
@brief Implementation of the basic parts of the OpenGrain API (init, shutdown, error reporting)
@author John Williamson
Copyright (c) 2011 All rights reserved.
Licensed under the BSD 3 clause license. See COPYING.
This file is part of the OpenGrain distribution... |
C | /*
* communication.h
*
* Created on: 17 sty 2019
* Author: Dunajski
*/
#ifndef COMMUNICATION_H_
#define COMMUNICATION_H_
#include <avr/interrupt.h>
#include "types.h"
#include "random.h"
extern unsigned char * p_dada;
/*
******************************************************************... |
C | // Authors: Connor Hanson, Tiger Ji
// Connor Hanson: cbhanson2@wisc.edu - chanson
// Tiger Ji: tfji@wisc.edu - tfji
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <semaphore.h>
#include "queue.h"
#include "queueStat.h"
/**
* Prints queue stats
*
* @param:
* Queue *q - pointer to queue to hav... |
C |
#include "ffisier.h"
//functia de creare a unui fisier
int creare(){
int n;
printf("**********Crearea fisierului**********\n");
printf("\nIntroduceti denumirea fisierului>>>");
scanf("%s", nume);
f=fopen(nume, "w");
if (f==NULL){
puts("\nFisierul nu a fost creat!");
return 0;
}
completare(0);
fclose(... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sort_input.c :+: :+: :+: ... |
C | //BORIS MOROZOV
#include "main.h"
// binary to "super" octal
char* binaryToSuperOctal(struct Instruction input){
struct Instruction revInst = reverseInstruction(input);
char* output = "";
char* currchar = "";
for(int i =0;i<15;i = i+3){
int temp =0;
for(int j =0;j<3;j++){
temp = temp +rev... |
C | #include<stdio.h>
int main()
{
int n=0;
scanf("%d",&n);
printf("%d",rev(n,0));
}
int rev(int x,int i)
{
if(x<10)
{
int r = (i*10)+x;
return r;
}
else
{
int c = x%10;
x=x/10;
i=(i*10)+c;
int r = rev(x,i);
return r;
}
}
|
C | #include <stdio.h>
#include <stddef.h>
#pragma pack(4)
struct bar {
int foo0;
int foo1;
int foo2;
long long bar;
};
#pragma pack()
#pragma pack(push, 4)
struct foo {
int foo0;
int foo1;
int foo2;
long long foo;
};
#pragma pack(pop)
int main(void)
{
printf("offset of bar is %zu\n", of... |
C | #ifndef ATTINY861_GPIOMAP_INCLUDED
#define ATTINY861_GPIOMAP_INCLUDED
#include "ATtiny861_Pins.h"
#include "ATtiny861_ReturnCodes.h"
/*
* Configuring and using GPIO requires knowledge of three registers:
* DDRxn: Data Direction Register, byte x, bit n
* PORTxn: Data Register, byte x, bit n
* PINxn: ... |
C | #include <stdio.h>
int main(int argc, char const *argv[]){
int numb=-1;
int numero;
int i;
int rotacao;
scanf("%d", &i);
while(i>0){
char nome[1001];
char final[1001];
char varia[1001];
char snome[1001];
scanf("%s", nome);
scanf("%s",... |
C | /*
08 Left vs Right.c
Run and end the sound process with different configurations. First,
both speaker channels, then just the right, then just the left.
NOTE: The takeaway from this is supposed to be that you can use -1
when starting a sound process to make only one of the two pin
option... |
C | #include "8DigitsDisplay.h"
#include "7SegDisp.h"
static uint8_t data[AMAUNT_DIGITS_8_DISPLAY+DIGIT_AMOUNT-1]; //arreglo de los numores del display emulado, la posicion 0 es el mas significativo. ej 340 -> 3|4|0|..
uint8_t *_8digits;
static int8_t cursorPosition=0;//posicion del cursor - dot
static int8_t lastDigi... |
C | #include "tickit.h"
#include "taplib.h"
#include "taplib-mockterm.h"
int main(int argc, char *argv[])
{
TickitTerm *tt = make_term(25, 80);
TickitRenderBuffer *rb;
int len;
rb = tickit_renderbuffer_new(10, 20);
// Clipping to edge
{
len = tickit_renderbuffer_text_at(rb, -1, 5, "TTTTTTTTTT", NULL);
... |
C | //defining our delay function.
// the input is our time delay value (defined in main)
void delay(long c)
{
long x;
for(x= c; x > 0; x--); //short delay of size 50, counts down from 50 to 1
} |
C | #include <stdio.h>
#include <string.h>
#define max_string_size 100
#define max_pattern_size 100
int pmatch();
void fail();
int failure[max_pattern_size];
char string[max_string_size];
char pat[max_pattern_size];
int pmatch(char *string, char *pat)
{
int i = 0, j = 0;
int lens = strlen(string);
int lenp ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "mymalloc.c"
#define malloc(x) mymalloc(x, __FILE__, __LINE__);
//#define calloc(x, y) mycalloc(x,y, __FILE__, __LINE__);
//#define realloc(x,y) myrealloc(x,y, __FILE__, __LINE__);
#define free(x) myfree(x, __FILE__, __LINE__);
struct node{
struct n... |
C | /*
Bruce Maxwell
Fall 2014
A simple test function for Module_draw that creates 3 X-wing fighters as line drawings
Requires the following functions to be defined
element_create
element_init
element_delete
module_create
module_add
module_delete
module_translate2D
module_scale2D
module_point
... |
C | /*project euler problem 2*/
#include<stdio.h>
#include<stdlib.h>
int main()
{
long long int a=1,b=2,c,add=2;
int i=1;
while(i>0)
{
c=a+b;
a=b;
b=c;
if(c>=4000000)
{
printf("%lld",add);
exit (0);
}
if(c%2==0)
... |
C | #include <stdio.h>
int sub(int x, int y) {
return x - y;
}
int main( ) {
int a = 5; int b = 10;
int diff1, diff2, diff3;
diff1 = sub(a,b);
diff2 = sub(100, b);
diff3 = sub(24, 25);
printf("diff1 = %d, diff2 = %d, diff3 = %d\n", diff1, diff2, diff3);
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
struct _node{
int data;
struct _node *next;
};
typedef struct _node node;
int main()
{
int i;
node *head,*ptr;
ptr = (node *)malloc(sizeof(node));
ptr->next = NULL;
while(1){
scanf("%d",&(ptr->data));
if(ptr->data==-1) break;
e... |
C | /*************************************************************************
> File Name: code12.c
> Author: SDW
> Mail:264459522@qq.com
> Created Time: 六 8/16 21:16:44 2014
************************************************************************/
//12.用 0-9 这十个数字可以组成多少无重复的 3 位数字
#include<stdio.h>
int main(int a... |
C | #include <stdio.h>
int func4(int edx, int esi, int edi) {
int eax = edx;
eax = eax - esi;
int ebx = eax;
ebx = ebx >> 31;
ebx = ebx + eax;
ebx = ebx >> 1;
ebx = ebx + esi;
if(ebx == edi) {
eax = ebx;
return eax;
} else if(ebx > edi) {
edx = ebx - 1;
e... |
C | #include <cs50.h>
#include <stdio.h>
void draw (int h);
int main (void)
{
int height = get_int("Height: ");
draw(height);
}
void draw (int h)
{
if (h == 0)
{
return;
}
draw(h - 1); // function call it self so if 0 return
for (int i = 0 ; i < h; i++)
{
printf("#");
... |
C |
#include "./key/bsp_key.h"
/**
* @brief tmΨ쪺I/O
* @param L
* @retval L
*/
void Key_GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/*}ҫGPIOf*/
KEY1_GPIO_CLK_ENABLE();
KEY2_GPIO_CLK_ENABLE();
/*ܫ䪺}*/
GPIO_InitStructure.Pin = KEY1_PIN;
/*]m}JҦ*/
GPIO_InitStructure.Mode = GPIO_MODE_INPUT; ... |
C | /*------Programmming Problem Chap 10 ---------
implement a virtual memory manager
group 16
------------------*/
//required header files
#include <string.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
const int PAGE_TABLE_SIZE = 256; //2^8 page table size
const int TLB_SIZE = 16; ... |
C | #include "common.h"
void print_queue(const Queue *q)
{
QueueNode *current = q->head;
while (current != NULL) {
printf("%d ", *((int *)current->value));
current = current->next;
}
printf("\n");
}
|
C | //authors:
// or shahar ( orshahar1@mail.tau.ac.il )
// michaelz ( zhitomirsky1@mail.tau.ac.il )
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include "common.h"
/// the base to be used for converting char to int
static const int BASE = 10;
FILE* read_num_from_file(FILE* f_input, int*... |
C | /*
** algo.c for algo in /home/coodie_d/rendu/test/B2/Allum-1
**
** Made by Dylan Coodien
** Login <coodie_d@epitech.net>
**
** Started on Sat Feb 7 17:44:08 2015 Dylan Coodien
** Last update Fri Feb 20 10:07:11 2015 Dylan Coodien
*/
#include <stdlib.h>
#include <stdio.h>
#include "my.h"
#include "alum1.h"
int ... |
C | #include "petsc_webserver.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <petscsys.h>
#include <limits.h>
PetscErrorCode create_tcpaccept_entry_bag(tcpaccept_entry **entryptr, PetscBag *bagptr, PetscInt n)
{
PetscErrorCode ierr;
tcpaccept_entry *entry;
PetscBag bag;
char ... |
C | #include "raylib.h"
typedef struct Nave {
Vector2 posicao;
int vidas;
int pontos;
} Nave;
static Nave nave;
void Navinha_Mover (Vector2 *nav) {
if (IsKeyDown(KEY_RIGHT)) {
if (nave.posicao.x < 790.0f) { //para não sair da janela
nave.posicao.x += 5.0f;
}
}
if (I... |
C | //==============================================================================
// 3D TEh̃TvłB
//==============================================================================
#include <stdio.h>
#include <LuminoC.h>
int main()
{
LNHandle sound;
LNVector3 soundPos = { 12.0, 0.0, 0.0 };
LNVector3 listenerPos = { 5, ... |
C | /*
Tier 1 : Part 6 : Question 3
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char guessing_password_string[20] , password_string[20];
char user_name_string[20], guessing_user_name_string[20], catch_the_return_feed;
int clean_array;
//clean the arrays
for(clean_array = 0; clean_array ... |
C | #include <stdlib.h>
#include "hello.h"
#include "empty.h"
void empty(void) {
return;
}
int iempty(int i) {
return i;
}
void *pempty(int i, int j) {
/* put some data on the stack to play with in the assembler */
int intiger = 1;
double dbl = 2;
char chr = 'c';
void *point = NULL;
cha... |
C | #include "lists.h"
#include <stdio.h>
#include <stdlib.h>
/**
* is_palindrome - check whether a linked list of integers is a palindrome
* @head: pointer to head in main function
* Return: 1 if it is a palindrome and -1 if not
*/
int is_palindrome(listint_t **head)
{
listint_t *ptr = *head;
int *arr, list_length... |
C | //
// main.c
// 5.3.10
//
// Created by 雅 on 2019/11/21.
// Copyright © 2019 雅. All rights reserved.
//
#include <stdio.h>
#define M 6
int s[M][M];
int main(void)
{
int i=0,j=0,k=1;
s[0][0]=1;
while (k<M*M) {
while (j<M-1&&!s[i][j+1]) {
s[i][++j]=++k;
}
while (i<M-1&... |
C | #include "Queue.h"
Queue *g_Queue = NULL;
// C캯
Queue *QueueListConstruction()
{
g_Queue = (Queue*)malloc(sizeof(Queue));
g_Queue->initQueue = InitQueue;
g_Queue->pushData = DataPush;
g_Queue->popData = DataPop;
g_Queue->delData = DataDel;
g_Queue->clearData= DataClear;
g_Queue->getAvliableSize = G... |
C | #include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int num,revn=0,p=0,temp,tdigit=0,originalnumber;
clrscr();
printf("Enter the number:-\n");
scanf("%d",&num);
temp=num;
originalnumber=num;
while(temp>0)
{
temp/=10;
tdigit++;
}
while(num>0)
{
revn+=((num%10)*pow(10,tdigit-1));
num/=10... |
C | /*
* =============================================================================
*
* Filename: 8.c
*
* Description: itos converts non-negative integers < 100 into words.
*
* Version: 1.0
* Created: 11-11-19 23:15:53 PM
* Revision: none
* Compiler: gcc
*
* A... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pixels_and_colors.c :+: :+: :+: ... |
C | /***************************************************************************************
* File Name : BSTree.h
* CopyRight : 2021 QG Studio
* SYSTEM : win10
* Create Data : 2021.4.24
*
*
*--------------------------------Revision History--------------------------------------
* No version Data ... |
C |
#include "drawarea.h"
#include "config.h"
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
//获得新的画布对象
struct drawarea * drawarea_new(struct window *window)
{
struct drawarea * cthis = (struct drawarea *)malloc(sizeof(struct drawarea));
if(!cthis)
return NULL;
//初始化内部成员
cthis->wind... |
C | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int *a, i;
a = (int *) calloc(5, sizeof(int));// Arreglo dinamico de 5
// este arreglo lo de arriba lo puedes poner mas adelante y cambiar como
// si fuera una variable lo puedes incrementar o decrementar
a[0] = 6;
a[1] = -512;
a[2] = 2001;... |
C | #include<stdio.h>
#include<stdlib.h>
// by debbah Mehdi Sofaine (MehdiSlik)
// note : in binarys search the vector must be sorted
// binary search of an element
int binary_search(int* vect ,int N,int x)
{
// debut :is the begin of vector vect
// fin : is the end of vector vect
// x :is the element w... |
C | #include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
void sigsegv_handler(int e){
fprintf(stderr, "Error: Segmentation fault by option --segfault registered by --catch\... |
C | #include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#if defined(_WIN32)
#include <winsock2.h>
int create_socket(char* destHost, short destPort, char* res)
{
WSADATA wsa;
SOCKET s;
// printw("\nInitialising Winsock...");
if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0)
{
// printw("Failed. Err... |
C | #include "bs-tree.h"
node *Raiz;
/*----------------------------------------------------------------------------*/
/* Calcula altura da arvore */
/*----------------------------------------------------------------------------*/
int h_tree( node **n) {
node *current =... |
C | #include<stdio.h>
#include<string.h>
void main()
{
char string1[50],string2[50];
printf("Enter strings to concatenate: \n");
scanf ("%s",string1);
scanf ("%s",string2);
strcat (string1,string2);
printf ("The concatenated string is: %s.\n",string1);
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* waiter_init.c :+: :+: :+: ... |
C | #include <stdio.h>
int main()
{
int a,sum=0,rem,base=1;
scanf("%d",&a);
while(a)
{
rem=a%2;
sum=rem*base+sum;
a=a/2;
base=base*10;
}
printf("%d",sum);
return 0;
}
|
C | /**************************************************/
/* */
/* Programmer: Abdullah Mahmoud */
/* */
/* Program 52: Mind your Ps and Qs */
/* */
/*... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"header.h"
/* t@CI[vۂNULL`FbN */
void fileOpenCheck(FILE **fp, char *filename, char *mode){
if((*fp = fopen(filename, mode)) == NULL){
printf("%s is failed open\n", filename);
exit(1);
}
return;
} |
C | #include "genericlist.h"
#include <stddef.h>
struct GenericList *reverseGenericList(struct GenericList *curr) {
if (!curr)
return NULL;
struct GenericList *prev = NULL, *next = NULL;
while (curr != NULL) {
next = curr->next;
curr->next = prev;
prev = curr;
curr = ne... |
C | #include<stdio.h>
#include<process.h>
#include<conio.h>
#define max 6
int queue_arr[max];
int rear=-1;
int front=-1;
void main()
{
int choice,ch;
clrscr();
while(1)
{
printf("1.Insert\n2.Delete\n3.Display\n4.Quit\n");
printf("Enter your choice");
scanf("%d", &choice);
switch(choice)
{
case 1:
{
int ... |
C | #include "dsm.h"
int permissions[NPAGES];
int set_permissions(void *addr, size_t len, int prot)
{
int dsm_page_num;
dsm_page_num = get_pagenum(addr);
if (dsm_page_num < 0 || dsm_page_num > NPAGES - 1) {
fprintf(stderr, "Error: out of dsm range");
return -1;
}
permissions[dsm_page_num] = prot;
... |
C | #ifndef REDUCE
#define REDUCE
bool equal_private_and_local(void *key1, unsigned size1, __local void *key2, unsigned size2)
{
/* bool flag1 = true, flag2 = true;
if(size1!=size2)
flag1 = false;
char *k1 = (char *)key1;
__local char *k2 = (__local char *)key2;
for(int i = 0; i< size1... |
C | /*
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
int main()
{
FILE *pidnya;
pidnya = fopen("/home/becak/modul2/pid_nomor5.txt", "r");
int pid_kill;
fscanf(pidnya, "%d", &pid_kill);
kill(pid_kill, SIGKILL);
fclose(pidnya);
return 0;
}
|
C | #include "../includes/ft_printf.h"
void add_sharp(t_printf *list)
{
list->sharp = 1;
}
void add_minus(t_printf *list)
{
char *num;
list->minus = 1;
if (ft_isdigit(list->format[list->i + 1]) || list->format[list->i + 1] == '-' || list->format[list->i + 1] == '+')
{
list->i++;
num = list->format;
num += lis... |
C | /**
* @file network.h Network API
* @ingroup core
*/
#ifndef _OUL_NETWORK_H_
#define _OUL_NETWORK_H_
#ifdef __cplusplus
extern "C" {
#endif
/**************************************************************************/
/** @name Network API */
/*******************... |
C | #include <stdio.h>
void count_func(int a[20]){
int count_par = 0;
int count_5 = 0;
for (int i = 0; i < 20; i++) {
if(a[i] % 2 == 0)
count_par++;
if (a[i] % 5 == 0)
count_5++;
}
printf("%d, %d\n", count_par, count_5);
}
int main(){
int a[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bsqv2.c :+: :+: :+: ... |
C | /*
* animation.c
*
* Created on: 05.01.2015
* Author: zaphod
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include "util.h"
#include "stripcontrol.h"
#include "animation.h"
#include "color.h"
uint8_t target_r, target_g, target_b = 0;
volatile uint8_t current_r, current_g, current_... |
C | #include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
uint32_t i32;
// 1111 1111 1101 0110 1101 1011
// 0011 1111 1101 0110 1101 1011
uint64_t value = 9766683;
// int64_t value = 4183771;
char s[40];//要转换成的字符数组
itoa(value,s,2);//itoa转为二进制
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
void Merge(int A[], int l, int m, int r) {
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m ;
int temp1[n1], temp2[n2];
for (int i = 0; i < n1; i++)
temp1[i] = A[l + i];
for (int j = 0; j < n2; j++)
temp2[j] = A[m + 1 + j];
i = 0;
j = 0... |
C | #include "levels.h"
#include "../herdem.h"
#include "../jaunty/jaunty.h"
void set_up_inter_level(void (*clean_up_function)())
{
int map_w = 1, map_h = 1, tw = WIN_W, th = WIN_H;
if(!(herdem_engine->parent.map = new_jty_map(
map_w, map_h, tw, th,
"images/scenes/level_int... |
C | #include<stdio.h>
struct dist
{
int f;
int in;
}c,d,sumd;
int main()
{
scanf("%d",&c.f);
scanf("%d",&c.in);
scanf("%d",&d.f);
scanf("%d",&d.in);
sumd.f=c.f+d.f;
sumd.in=c.in+d.in;
if(sumd.in>=12.0)
{
sumd.in=sumd.in-12.0;
++sumd.f;
}
printf("Sum of distances = %d feet %d inches... |
C | //=============================================================================
//
// File: FrMath.h
//
// Header file for FrMath.c. Fractional Math.
//
// NOTES: 1) Named functions all start with Fr (Fract) or Fl (Float)
// followed by give <s,d> for the sizes of arguments and then
// the return va... |
C | //Header file for an implementation of a basic list ADT usuing the linked list data structure
//Keaton Armstrong
//STRUCTS
struct node{
int data;
struct node* next;
};
typedef struct node node_t;
struct list{
node_t* head;
node_t* tail;
};
typedef struct list Linkedlist_t;
//FUNCTIONS
node_t* nodeCreate (in... |
C | # include <stdio.h>
# include <stdlib.h>
struct node
{
int data;
struct node* next;
};
void add(struct node* h,int a)
{
struct node* new=(struct node*)malloc(sizeof(struct node));
new->next=NULL;
struct node* temp;
temp=h;
while(temp->next!=NULL)
{
temp=temp->next;
}
temp->next=new;
new->data=a;
}
void print(struct... |
C | #include <stdlib.h>
#include <string.h>
#include <time.h>
#include <stdio.h>
#include "search.h"
int main(int argc, char *argv[]){
int min = atoi((argv[1]));
int max = atoi((argv[2]));
int rep = atoi((argv[3]));
int do_array=0,
do_barray=0,
do_list=0,
do_tree=0;
if(argv[4]!=NULL){
... |
C | #include <unistd.h>
void my_putchar(char c)
{
write (1, &c, 1);
}
int my_putstr(char const *str)
{
for (int i = 0; str[i] != 0; i++)
my_putchar(str[i]);
return (0);
}
int my_strlen(char const *str)
{
int i = 0;
for (; str[i] != 0; i++);
return (i);
}
void my_swap(char *a, char *... |
C | #include <stdio.h>
#include<string.h>
void main()
{
char g[10];
int a,i,j,flag=0;
printf("enter any string");
scanf("%s",g);
a=strlen(g);
for(i=0,j=a-1;i<=a/2;i++,j--)
{
if(g[i]!=g[j])
{
printf("not a palindrome");
flag=1;
break;
}
}
if(flag==0)
{
printf("palindrome");
}
}
|
C | #include <unistd.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_putstr(char *str)
{
int index;
index = 0;
while(str[index] !='\0')
{
ft_putchar(str[index]);
index++;
}
}
void ft_print_comb(void)
{
int indexA;
int indexB;
int indexC;
char *nbr;
nbr = "0123456789";
indexA = 0;
indexB = 1;
... |
C | #include <SDL2/SDL.h>
#include <SDL2/SDL_timer.h>
#include <stdio.h>
typedef int bool32;
typedef struct Vector2 {
float x, y;
} Vector2;
typedef struct Building {
Vector2 origin;
Vector2 position;
int width;
int height;
bool32 active;
} Building;
typedef struct Player {
Vector2 po... |
C | /*!
* @file image_deal.c
* @brief ڵõĺ
* @details
* @author lvؼfox
* @version v1.0
* @date 2019-2-26
* @to do
*
*/
#include "include.h"
#include "image_deal.h"
#define Height ROW
#define Wide COL
ImageDeal_ForLight ImageDeal_Camera1;
ImageDeal_ForLight ImageDeal_C... |
C | // euler15.c
/*
Starting in the top left corner of a 2 x 2 grid, and being only able to move left and right,
there are exactly 6 routes to the bottom right corner.
rrdd,
rdrd, rddr,
drrd, drdr,
ddrr
How many such routes are there on a 20 x 20 grid
SOLVED
*/
/*
These are the number of coin flip sequences that produce... |
C | #include<stdio.h>
#include<string.h>
int main()
{
int i,j,flag;
int h[150];
char s[100001];
scanf("%s",s);
{
flag=0;
memset(h,0,sizeof(h));
j=strlen(s);
for(i=0;i<j;i++)
{
h[s[i]]++;
}
for(i=50;i<150;i++)
{
if(h[i]... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int x[100][100],y[100][100],z[100][100],i,j,k,l,a,b,c;
printf("Enter row and column number of first matrix: ");
scanf("%d%d",&i,&j);
printf("Enter row and column number of second matrix: ");
scanf("%d%d",&k,&l);
if(j!=k)
{
... |
C | #include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include "support.h"
/*
* tail_file() - display the last numlines lines of a file or stdin
*/
void tail_file(char *filename, int numlines) {
/* TODO: Complete this function */
if(numlines <= 0){
printf("Please enter a number greater than 0\n");
r... |
C | double bilinear_int(CImg<double> &in,double x,double y,int c)
{
int i,j;
double a,b,first_pt,second_pt,third_pt,forth_pt;
if(x < 0 or y < 0 )
{
// cout << "inside bracket" << endl;
return 0.0;
}
else
{
// cout << "insice else" << endl;
i =floor(x);
j =floor(y);
// cout <<... |
C | #include "sniff.h"
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <pcap.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include "dispatch.h"
// Application main sniffing loop
void sniff(char *interface, int verbose) {
//Let's make some ... |
C | #include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "vector.h"
void vec_init(vector *v) {
v->cap = 0;
v->len = 0;
v->buf = NULL;
}
void vec_clear(vector *v) {
free(v->buf);
vec_init(v);
}
void vec_insert(vector *v, size_t idx, void *val) {
if(idx > v->len) {
return;
}
if(v->len >= v->cap)... |
C | #include "graphics.h"
static byte* const framebuf = (byte*) 0xA0000;
byte* renderBuf;
#ifdef DOUBLE_BUFFERED
byte* depthBuf;
#endif
static byte depthVal;
static byte color;
static bool depthTest;
static int drawMode;
mat4 modelMat;
mat4 viewMat;
mat4 projMat;
static bool glDebugOn = false;
// (x1, y1) is the top of ... |
C | //
// strarr.c
//
//
// Created by Adrian Thomas Clinansmith on 2019-04-20.
//
#include "strarr.h"
/*********************************/
/*** private helper prototypes ***/
/*********************************/
FILE* openAndGetMetadata(const char* filepath, size_t* numWords, size_t* maxLength);
/*********************... |
C | #include "complete_routh_array.h"
#include "source_1.h"
/**
* @brief attempts to complete routh array. Exits if row startinf with 0 or a row of 0s is encountered.
*
* @param rth
* @param i
* @return int
*/
int complete_routh__array(float* rth,int i)
{
float a1,a2,b1,b2,z;
//int changes... |
C | // Karen Villarreal 1B
// Trabajo Practico N2
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "FuncionesEmpleados.h"
int main()
{
int respuesta;
int retorno;
int idIngresado;
int crearId = 99; //Se inicializa un contador en 99 para crear las ID
Employee listaEm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.