language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print.c :+: :+: :+: ... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
static char *studentName = "Bowen Johnson";
// report whether machine is big or small endian
void bigOrSmallEndian()
{
int x = 1;
if (*(char *)&x == 1)
{
printf("byte order: little-endian\n");
}
else
{
printf("byte order: big-endian\n");
}
}
//... |
C | #include <stdio.h>
int main(){
int i,low,high,mid,n,key,array[100];
printf("enter number of element : ");
scanf("%d",&n);
printf("enter %d integer\n",n);
for(i=0;i<n;i++){
printf("enter #%d value",i+1);
scanf("%d",&array[i]);
}
printf("enter value to find");
scanf("%d",&key);
low=0;
high=n-1;... |
C | //------------------notes--------------------
const float As3 = 233.08*2;
const float A3 = 220.00*2;
const float B3 = 246.94*2;
const float Cs3 = 138.59*2;
const float Cs4 = 277.18*2;
const float C3 = 130.81*2;
const float C4 = 261.63*2;
const float Ds3 = 155.56*2;
const float D3 = 146.83*2;
const float D4 = ... |
C | /*
* os.h
*/
//
// some useful types
//
typedef void (* pfv_t)();
typedef int (* pfi_t)();
typedef unsigned int (* pfu_t)();
typedef union namenum {
char name[4];
short half[2];
long num;
void *ptr;
float fnum;
} namenum_t;
#define TRUE 1
#define FALSE 0
#define NULL 0
#define DEAD 0xdeadbeef
//
// time
//
... |
C | #include "pit.h"
#include "paging.h"
#define ASM 1
/*init_pit
* DESCRIPTION : Initialize PIT
* INPUT : None
* OUTPUT : None
* RETURN VALUE: None
*/
int32_t terminal_index;
void init_pit() {
/*initialize the terminal_index as 0*/
terminal_index = 0;
/*pit_call initialized as flag use for first three iterat... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int a = 22, b = 11;
int sum = a + b;
printf("Sum = %d\n",sum);
return 0;
}
|
C | /*
* File: Main.c
* Author: Armstrong Subero
* PIC: 18F4553 w/Ext OSC @ 16MHz ; PLL to 48MHz, 5v
* Program: 08_ADC
* Compiler: XC8 (v1.38, MPLAX X v5.05)
* Program Version: 1.0
*
*
* Program Description: This Program Allows PIC18F4553 to use the ADC module
* ... |
C | #pragma once
#include "mathLib.h"
struct Vertex
{
Vec3 position;
Vec3 normal;
Vec3 color; // alpha of color is always 1
Vertex(const Vec3& pos, const Vec3& nor, const Vec3& col):
position{ pos },
normal{ nor },
color{ col }
{
}
Vertex(const Vertex& v):
posi... |
C | #include "inicio.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lista.h"
#include "plantillaDiscos.h"
#include "plantillaParticion.h"
#include "plantillaReporte.h"
int ope1,ope2,p,err,h; //p=1 si esta activo
char comando[8],tk[100],unit[3],path[100],type[6],fit[3],name[15],delete[5],add[8],id[... |
C | /**************************************************************
*
* userprog/ksyscall.h
*
* Kernel interface for systemcalls
*
* by Marcus Voelp (c) Universitaet Karlsruhe
*
**************************************************************/
#ifndef __USERPROG_KSYSCALL_H__
#define __USERPROG_KSYSCALL... |
C | #include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
/*
* PRIME_T - Liczby Pierwsze
* http://pl.spoj.com/problems/PRIME_T/
* http://ideone.com/4eSs3u
*/
int main(void)
{
int32_t nTest, i;
int16_t number, tmp, wynik;
int8_t j;
scanf("%" SCNd32, &nTest);
for (i = 0; i < nTest; i++) {
scanf("%" SCNd1... |
C | #include<stdio.h>
void main() {
float notas[4]={}, aluno[10]={};
int contador=0;
while (contador<10) {
printf("Digite a primeira nota do %dº aluno: ",contador+1);
scanf("%f",¬as[0]);
printf("Digite a segunda nota do %dº aluno: ",contador+1);
scanf("%f",¬as[1]);
printf... |
C | #include<stdio.h>
void main()
{
int a,b,c,d,e,f;
printf("enter any number whose once digit is less than five ");
scanf("%d",&a);
b = a/10;
c = a%10;
printf("\n the last digit of the number is %d",c);
e = 2*c;
f = b*10 + e;
printf("\n the new number obtained after doubling its once digit is %d",f);
}
|
C | #include "rlutils_command_args.h"
#include "redismodule.h"
#include "memory/rlutils_memory.h"
#include "utils/arr_rm_alloc.h"
#include <string.h>
#include <assert.h>
#define ArgsMask uint64_t
void RLUTILS_PRFX_ArgIteratorInit(RLUTILS_PRFX_ArgIterator* iter, RedisModuleString** argv, size_t argc){
*iter = (RLUTI... |
C | /* Prompts user for last name, first name, and middle name individually
** Display in this format B. L. Jones
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (void){
char lname[60], fname[60], mname[60], dest[160];
puts("Last Name:");
fgets(lname,60,stdin);
puts("First Nam... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* st.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <string.h>
typedef char* string;
//TODO fix
string getString(void)
{
string name;
printf("Give me a name: ");
scanf("%s", name);
return name;
}
void main(void)
{
string name = getString();
int i; //switch to C99 in order to declare i inside for loop
for(i=0; i < strlen(name... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define M_PI 3.14159265358979323846
double f(double x);
int main()
{
double a = 0;
double b = M_PI;
double iterations = 1000;
double dx = (b - a) / (iterations + 1);
double hL = 0;
double xL = 0;
double i = 0;
for (i = a + dx; ... |
C | #ifndef CHESSGAME_H_
#define CHESSGAME_H_
#include <stdio.h>
#include "ChessGameCommon.h"
#include "ArrayList.h"
#define WHITE_KING_SYMBOL 'k'
#define BLACK_KING_SYMBOL 'K'
/**
* ChessGame Summary:
*
* A container that represents a classic chess game, a two players or one player.
* The container supports the fol... |
C | #include "stdio.h"
#include "../lib/CSLink.h"
#include "stdlib.h"
int main() {
CSLink *L;
ElemType arr[5] = { 1, 2, 3, 4, 5 };
/*
InitList(&L);
for (int i = 1; i <= 5; ++i) {
Insert(&L, i, i);
}
printf("len=%d\n", GetLength(L));
Display(L);
Delete(&L, 3);
Display(L);
DestroyList(&L);
*/
CreateLinkR(&L,... |
C | #include<stdio.h>
int main()
{
int i=0,a=0;
while(i<20)
{
for(;;)
{
if((i%10)==0) break;
else i--;
}
i+= 11; a += i;
}
printf("%d\n",a); // 32
return 0;
}
#if 0
//-189 ת
void rotate(int* nums, int numsSize, int k)
{
k = k%numsSize;
reverse(nums, 0, numsSize - 1);
reverse(nums, 0, k - 1);
rever... |
C | #include <stdio.h>
int main()
{
int i=0, j=0;
printf ("i=%d, j=%d\n", i, j);
printf ("i++=%d, ++j=%d\n", i++, ++j);
printf ("i=%d, j=%d\n", i, j);
}
|
C | /* Max Henrique Barbosa - 16/0047013
Érico Maximiano - 16/0070287 */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <math.h>
//-------------------- DECLARACAO DE FUNCOES ---------------------
int gerarNumeroAleatorio ();
int menorValor(int *,int ,int);
int transformaBinD... |
C | /* cx22-ap5.c */
#include <stdio.h>
#include "lw_oopc.h"
INTERFACE(IA)
{
void (*init)(void*);
void (*deposit)(void*, double);
void (*withdraw)(void*, double);
};
CLASS(Account)
{
IMPLEMENTS(IA);
double amount;
char state;
void (*state_action)(void*);
void (*message_O)(void*);
};
static void init(v... |
C | #include "headers/evts.h"
/**
* Mousemove event callback function handler.
*
* @param eventType Flag defining event type
* @param e Event object
* @param userData Callback parameter
* @return Status code
*/
EM_BOOL mouse_callback(int eventType, const EmscriptenMouseEvent *e, void *userData) {
if (eventTy... |
C | #include "stdio.h"
#include "unistd.h"
#include "stdlib.h"
#include "sys/types.h"
//#include "types"
int main(void){
char** argv = (char**) malloc(3*sizeof(char*));
argv[0] = "/bin/ls";
argv[1] = ".";
argv[2] = NULL;
for(int i = 0; i< 10; i++){
printf("%d\n", i);
if(i == 3){
... |
C | #include <stdio.h>
#include <math.h>
#include <string.h>
/*
E3: More functions and scoping trials
E4: Using static for variable persistence between calls
*/
void p(int);
void fun(int);
int x = 4;
int main()
{
//E4-3
//printf("%d\n", x);
//p(x);
//E4-4: run fun() 5 times
for(int c = 1;c<=5;c++)
{
fun(5);
}... |
C | #include <stdio.h>
#define message_for(a,b) printf(#a " and " #b ",we love you!\n");
#define tokenpaster(n) printf("token" #n "=%d",token##n)
int main(void)
{
message_for(xie,zhi);
int token34=34;
tokenpaster(34);
return 0;
} |
C | /* ************************************
*ͨWindows API
* ʾ
* virtual.c
* 5.4.2 ͷſɶдڴҳ
**************************************/
/* ͷļ*/
#include <windows.h>
#include <stdio.h>
#include "../env_dll/env.h"
/*************************************
* int main(void)
* ʾڴʹ
*
* δʹ
*********************... |
C | typedef int SDataType;
typedef struct Stack {
SDataType *arr;
int top;
int capacity;
}Stack;
void StackInit(Stack *ps );
void StackPush (Stack *ps,SDataType data);
void StackPop(Stack *ps);
SDataType StackTop(Stack *ps);
int StackEmpty(Stack *ps);
void StackDestroy(Stack *ps);
int StackSize(Stack *ps);
void S... |
C | //
// main.c
// Bubblesort
//
// Created by Simon Schöpke on 06.01.21.
//
#include <stdio.h>
#define MAX_LENGTH 100
void bubblesort_v2(int **a, int length)
{
int i;
int j;
for (i = 0; i < length - 1; i++)
{
for (j = 0; j < length - i - 1; j++)
{
if (*a[j] > *a[j + 1])
... |
C | #include<stdio.h>
#include<String.h>
void main()
{
char s[100],s1[100],ch,s2[100],h=0,c;
int i,v=1;
clrscr();
printf("Enter the String ::");
gets(s);
s1[0]=s[0];
for(i=0;s[i]!='\0';i++)
{
ch=s[i];
c=s[i+1];
if(ch==' '&&c!=' ')
s1[v++]=c;
}
for(i=0;i<v-1;i++)
printf("%c%c ",s1[i],'.');
for(i=strlen(s)... |
C | #include<stdio.h>
#include<stdlib.h>
#include"FindRank.c"
int subsetRank(struct Node* root, int l,int u,int x)
{
return findRank(root,x) - findRank(root, u) + 1;
}
int main()
{
int n;
printf("enter no of elements\n");
scanf("%d",&n);
printf("enter array\n");
struct Node* root = (struct Node*)m... |
C | #include <stdio.h>
#include <cs50.h>
//
int main(void){
int numbers[16] = get_long("What's your card number?\n");
printf("%i\n", numbers);
/*if(numbers > 5599999999999999 || numbers < 4000000000000){
printf("INVALID\n");
}
char number = numbers;
int first = 0;
int second = 0;
f... |
C | #if !defined(COMMON_H)
#define COMMON_H
/**
* Boolean type.
*/
enum Boolean {
FALSE, /**< False is zero. */
TRUE /**< True is not zero. */
};
/**
* Gets the minimum value.
*
* @param x A value.
* @param y Another value.
* @return Return the smaller of x and y. If x equals y, return y.
*/
#... |
C | #include <avr/io.h>
#include <util/delay.h>
#include "i2c.h"
#define CLOCK_ADDRESS 0x54
#define CLOCK_ADDRESS_W (CLOCK_ADDRESS << 1)
#define CLOCK_ADDRESS_R (CLOCK_ADDRESS_W | 0x01)
struct Time {
uint8_t hours
, minutes
, seconds;
};
void tick(void);
volatile struct Time curr_time;
void t... |
C | /*-----------------------------------------------------------------------*
* filename - puts.c
*
* function(s)
* puts - puts a string on a stream
*-----------------------------------------------------------------------*/
/*
* C/C++ Run Time Library - Version 10.0
*
* Copyright (c) 1987, 2000 b... |
C | #include<stdio.h>
int main()
{
int n, q;
scanf("%d %d", &n, &q);
int i, j;
int l, r, t;
int a[102] = {};
for (i = 0; i < q; i++)
{
scanf("%d %d %d", &l, &r, &t);
l--;
for (j = l; j < r; j++)
a[j] = t;
}
for (i = 0; i < n; i++)
... |
C | /* @author Praveen Reddy
* @date : 2021-09-03
* @desc Creating Soft Link using symlink system call
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
int main(){
const char* src="/home/praveen/IIITB/Term 1/Software Systems/Lab Exercises/Hands_on_List1/test";
const char* link_path=... |
C | // Lab4-2
#include <stdio.h>
#include <stdbool.h>
double* sort(double num[])
{
double num_check;
int n = 0;
while (true)
{
int nub = 0;
for(int i=0 ; i<2 ; i++)
{
if(num[i] <= num[i+1]) // check all number sort
nub += 1;
else
... |
C | #ifndef __HASH_MAP_H
#define __HASH_MAP_H
struct hash_map_node {
char* key;
char* value;
struct hash_map_node* next;
};
struct hash_map {
struct hash_map_node* _node;
char* _buffer;
struct hash_map* (*put) (struct hash_map* this, char* key, char* value);
char* (*get) (struc... |
C | // Trie that automatically adds to array create new indexes - Jared Johansson
// Created March 2017
// Last updated May 2018: added ability to print and destroy tree
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Trie-SM.h"
#define DEBUG 0
// Allocates memory for a trieNode, O(1)
Trie *createNo... |
C | /*
* eval.c
* Facility: m4 macro processor
* by: oz
*/
#include "mdef.h"
#include "extr.h"
extern ndptr lookup();
extern char *strsave();
extern char *mktemp();
/*
* eval - evaluate built-in macros.
* argc - number of elements in argv.
* argv - element vector :
* argv[0] = definition of a user
* ... |
C | #include <stdio.h>
#define byte char
void print_bin(unsigned a);
int main()
{
print_bin(-93);
return 0;
}
void print_bin(unsigned a)
{
int b = (int) sizeof a;
unsigned mask = 1;
printf("mask=%d\n", mask);
if ((int)a<0)
printf("-");
a =~a;
for (mask =0x10000000; mask >=1; mask>>=1)
if (>=0)
printf((!(a&m... |
C | #include<stdio.h>
int main()
{
int a = 5, b = 6, c = 2, d = 4;
int x,y;
x = a * b;
y = c * d;
printf("%d\n", x);
printf("%d\n", y);
return 0;
}
|
C | #include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/wait.h>
int main(){
pid_t pid;
int ret = 1;
int status;
pid = fork();
if (pid == -1){
// pid == -1 means error occured
printf("can't fork, error occured\n");
exit(EXIT_FAILURE);
}
else... |
C | /*======================================================================
t <- ISATOMF(F)
Is Atomic Formula?
\Input
\parm{F} is a quantifier--free formula.
\Output
\parm{t} is 1 if \v{F} is an atomic formula, 0 otherwise.
====================================================================... |
C | #include"SeqList.h"
#include<assert.h>
void SeqListInit(SeqList* seqlist, int capacity){
//жָǷΪ
//if (seqlist == nullptr){}
assert(seqlist);
//ڶϿٿռ
seqlist->array = (SDateType*)malloc(sizeof(SDateType) * capacity);
//жǷΪ
assert(seqlist->array);
seqlist->size = 0;
seqlist->capacity = capacity;
}
void SeqListD... |
C | #include <stdio.h>
#include <stdlib.h>
// The includes listed in the lstat man page.
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main(int argc, char **argv) {
// In order for this demo to work, create a file named example.txt in the
// same directory as this code.
char *path = ... |
C | #include<stdio.h>
int main(){
long long B[64][64],n;
int i,j,k;
for(i=0;i<64;i++) B[1][i]=i;
for(i=2;i<64;i++){
B[i][0]=0;
for(j=1;j<64;j++)
B[i][j]=B[i][j-1]+B[i-1][j-1]+1;
}
while(scanf("%d%lld",&k,&n),k!=0&&n!=0){
if(k>63) k=63;
if(n>B[k][63]) puts("More than 63 trials needed.");
else{
for(i=1;... |
C | #include <stdio.h>
#include <stdlib.h>
int static compare (const void* first, const void* second);
int minimumCost(int price[], int n);
int main(){
int n;
printf("Enter the size of array : ");
scanf("%d", &n);
int price[n];
for(int i=0; i<n; i++){
printf("Enter the component : ");
scanf("%d", &price... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../include/Interface.h"
void printRecord(patientRecord record)
{
printf("%s | %s | %s | %s | %s | %d | %d-%d-%d | %d-%d-%d\n", record.recordID, record.patientFirstName, record.patientLastName, record.diseaseID, record.country, record.age, recor... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define CHECK_ALLOC(x) if(!(x)) { puts("Memory allocation error!"); exit(1); }
char **allocate(int m, int n) {
char **table;
table = (char **) malloc(m * sizeof(char*));
CHECK_ALLOC(table);
for (int i = 0; i < m; i++) {
table[i] =... |
C | #include <stdio.h>
#include <stdlib.h>
#include "listaEncadeada.h"
Lista* create(){
Lista* novaLista = (Lista*) malloc (sizeof (Lista)); // 1 Complexidade Espacial, 1 Complexidade Temporal
if (novaLista != NULL){ // 1 Complexidade Temporal
novaLista->inicio = novaLista->fim = NULL; // 2 Complexidade Temporal
n... |
C | #include<stdio.h>
long kaijo(int);
int main(void){
int a=0;
printf("Type Integer");
scanf("%d",&a);
printf("%2d!=%10ld\n",a,kaijo(a));
return 0;
}
long kaijo(int n){
if(n==0)
return 1L;
else
return n*kaijo(n-1);
}
|
C | /*
* SNAPSPECKS: tabulate a snapshot in specks format
*
* 7-nov-00 PJT Created, Q&D
* 11-mar-01 PJT time floating
* 19-may-01 integer again?
*/
#include <nemo.h>
#include <snapshot/snapshot.h>
#include <snapshot/body.h>
#include <snapshot/get_snap.c>
string defv[] = { /* DEFAULT IN... |
C | //
// qweue.c
// Scientific_work_v2.0
//
// Created by Artem on 18/08/2018.
// Copyright © 2018 Artem. All rights reserved.
//
#include "Header.h"
int* creatr_qweue(int n){
int *result = calloc(n+2, sizeof(unsigned int));
result[0] = n+2;
result[1] = 2;
return result;
}
void push_qweue(int *qweue... |
C | #include <stdio.h>
main(){
int a, b;
a = 10;
b = 11;
a >= b? printf("a e maior ou igual a b") : printf("a nao e maior ou igual a b"); // nao precisa usar o if - condicional ternario
}
|
C | #include<stdio.h>
#include<math.h>
typedef long long ll;
int nxt=0;
long primes[78500];
ll fac[78500][2];
void init(){
ll n=int(1e6)+1;
int *arr=new int[n];
int i,j;
for(i=2;i<n;i++){
if(arr[i]) continue;
primes[nxt++]=i;
for(j=2*i;j<n;j+=i)
arr[j]=1;
}
}
int main... |
C | #include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
/**
* infinite_while - Sleeps infinitely
*
* Return: 0
*/
int infinite_while(void)
{
while (1)
{
sleep(1);
}
return (0);
}
/**
* main - Creates 5 zombie processes
*
* Return: EXIT_SUCCESS if function p... |
C | #include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/unistd.h>
#include <linux/syscalls.h>
static unsigned long **find_sys_call_table(void)
{
unsigned long offset;
unsigned long **sct;
// PAGE_OFFSETから探索
for(offset = PAGE_OFFSET; offset < ULLONG_MAX; offset += sizeof(v... |
C | #include <stdio.h>
#include <stdlib.h>
#include "E2funciones.h"
//argv[1] = orden(Ascendente = 1, Descendente = 2)
//argv[2] = datos.bin
int main(int argc, char const *argv[])
{
system("clear");
if (argc<3)
{
printf("Error faltan datos para ejecutar el programa. Por favor llame al programa de esta forma:\n\n");... |
C |
//@@ TESTS: TEST_NULL TEST_STRCPY TEST_STRCPY2 TEST_STRCAT TEST_STRCHR TEST_STRDUP TEST_STRPBRK TEST_MEMCPY TEST_MEMCPY2 TEST_MEMMOVE TEST_MEMSET TEST_MEMCHR
//@@ TESTS: TAINT NO_TAINT
#include <string.h>
#include <stdio.h>
int main()
{
char danger[100];
char safe[100];
char other[100];
#if defined(TAIN... |
C | /* esse foi o primeiro código que eu testei mas deu errado
#include <stdio.h>
int main () {
int XE, YE, XD, YD;
int XP, YP;
scanf ("%d %d %d %d",&XE, &YE, &XD, &YD);
scanf ("%d %d", &XP, &YP);
// esse primeiro if representa o caso baso descrito no enunciado da questão
if (XE < XD && YE > YD) {
if (XP >= XE && XP... |
C | #include "Bibliotecas.h"
int minusculas(char palavra[])
{
int i;
int aux = strlen(palavra);
if (aux == 0 || palavra == NULL || strcmp(palavra, " ")==0)
{
return 1;
}
for (i = 0; i < aux; i++)
{
palavra[i] = tolower(palavra[i]);
}
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int *getConjuntoFatorial(int, int);
int main()
{
int n0, size, *vetor, i;
scanf("%d",&n0);
scanf("%d",&size);
vetor = getConjuntoFatorial(n0, size);
for(i=0;i<size;i++){
printf("%d ",vetor[i]);
}
return 0;
}
in... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include"SeqList.h"
void SeqListInit(SeqList* ps)//ʼ
{
assert(ps);
ps->_array = NULL;
ps->_capacity = 0;
ps->_size = 0;
}
void SeqListDestory(SeqList* ps)//
{
assert(ps);
if (ps->_array)
{
free(ps->_array);
ps->_array = NULL;
ps->_capacity = 0;
ps->_size = 0;
}
}
Seq... |
C | // Programa que imprime los argumentos de la linea de
// comandos y sale
#include <stdio.h>
int main(int argc, char **argv)
{
while (*argv != NULL)
printf("%s\n", *argv++);
return 0;
}
|
C | #include <stdio.h>
/*The problem: Given a Matrix of 0's and 1's, Find the size of the biggest square submatrix
that conatins no 1's
Sample input 1
0 0 0
0 0 0
0 0 0
output: 3
Sample input 2
1 0 0 1
0 0 0 0
0 0 0 0
1 0 0 1
output: 2
*/
#define ROW 5
#define COLUMN 7... |
C | #include "jit/ir/passes/pass_stat.h"
#include "core/assert.h"
#include "core/math.h"
#include "core/string.h"
static struct list s_stats;
void pass_stat_register(struct pass_stat *stat) {
list_add(&s_stats, &stat->it);
}
void pass_stat_unregister(struct pass_stat *stat) {
list_remove(&s_stats, &stat->it);
}
voi... |
C | #include <stdio.h>
#include <stdlib.h>
#include "listDin.h"
int main()
{
ListDin l1,l2,l3;
IdxType val;
ElType min, max,idx;
CreateListDin(&l1,5);
CreateListDin(&l2,5);
displayList(l1);
printf("\n");
printf("bikin list 1:\n");
printf("\n");
readList(&l1);
displayList(... |
C | #include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <math.h>
#define TASCII_SIZE 128
enum {
PROG_NAME,
K_PARAM,
OBS_NUM,
TEST_NAME,
DATA_NAME,
ARG_NUM
};
long double euclid_dis(unsigned int obs_num, long double *argsA, long double *argsB){
long double dis = 0;
#ifdef DEBUG... |
C | #include "urg_ctrl.h"
#include "math_utils.h"
#include <stdio.h>
#include <stdlib.h>
static void urg_exit(urg_t *urg, const char *message)
{
printf("%s: %s\n", message, urg_error(urg));
urg_disconnect(urg);
#ifdef MSC
getchar();
#endif
exit(1);
}
int main(int argc, char *argv[])
{
//const char device[] =... |
C | #include<unistd.h>
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<string.h>
#define BUFSIZE 1024
int cout(int line, char buf[])
{
int n=0;
int cout = 0;
for(int i =0; i<strlen(buf); i++)
{
cout ++;
if(n == line) break;
if(buf[i] == '\n')
n ++;
... |
C | #include<stdio.h>
int main (void)
{
int value=0;
float factorial=1 ;
int i , x, multi_x;
float sum=1 ;
printf("Please Enter a Value:") ;
scanf("%d" , &value ) ;
printf("Please Enter a 'X' Value:") ;
scanf("%d" , &x ) ;
multi_x=x;
if(value!=0)
{
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string.h>
#define FALSE 0
#define TRUE 1
typedef struct {
char name[10];
int age;
float salary;
} humanBeing;
int humansEqual(humanBeing, humanBeing);
int main() {
humanBeing persona1, persona2;
struct {
... |
C | #include <stdio.h>
#include "Task3.h"
void printPascalTriangle(int depth) {
int n;
int k;
int i;
long long term;
for (n = 0; n<depth; n++)
{
printf("|L%2d|", n);
for (i = n; i <= depth; i++) {
printf("%3c", ' ');
}
for (k = 0; k <= n; k++) {
term = pascalTriangle(n, k);
printf("%6lld", term);
... |
C | /* Disciplina: Computacao Concorrente */
/* Prof.: Silvana Rossetto */
/* Codigo: Projetar e implementar um algoritmo concorrente para o problema de multiplicação de matrizes e coletar informações sobre o seu tempo de execucão*/
#include<stdio.h>
#include<stdlib.h>
#include"timer.h"
#include<pthread.h>
float *matrizP... |
C | #include<stdio.h>
#include<string.h>
int *s;
int *e;
int *c;
int ans[49];
int inline scan()
{
int N = 0;
char C;
C=getchar_unlocked();
while (C < '0' || C>'9') C=getchar_unlocked();
while (C >= '0' && C <= '9')
{
N = (N<<3) + (N<<1) + C - '0';
C=getchar();
}
return N;
}... |
C | /*
* Project name:
PWM (PWM library Demonstration)
* Copyright:
(c) Mikroelektronika, 2008.
* Revision History:
20081218:
- initial release;
* Description:
This is a simple demonstration of PWM library, which is being used for
control of the MCU's PWM module. The module is ... |
C | #define _GNU_SOURCE
#include <errno.h>
#include <net/if.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <unistd.h>
unsigned if_nametoindex(const char* name) {
struct ifreq ifr;
int fd, r;
if ((fd = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0) {
return... |
C | #include <stdio.h>
#include <string.h>
int addr_space = 24;
int block_size;
int num_sets;
int assoc;
char write_policy;
int cache_size;
int num_blocks;
int tag;
int offset;
int index;
/* Will process and output all flags */
void GetFlags(int argc, char *argv[])
{
if (argc == 1)
{
block_size = 32;
num_sets = 64... |
C | /*
* File: LAB8.c
* Author: Jos Santizo
*
* Creado el 4 de octubre de 2021
*
* Descripcin: Contadores que aumentan por medio de una entrada analgica (pots)
*/
//---------------------Bits de configuracin-------------------------------
// CONFIG1
#pragma config FOSC = INTRC_NOCLKOUT// Oscillator Selection bits... |
C | #include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "transaction.h"
#include "apriori.h"
int main(int argc, char *argv[]) {
clock_t begin = clock();
if (argc != 3) {
printf("Usage: ./apriori <threshold> <num transactions>\n");
return EXIT_FAILURE;
}
int support_threshold = atoi(argv[1]);
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node {
int cof,exp;
struct node *link;
};
struct node *r=NULL,*r1=NULL,*r2=NULL;
void display(struct node *,struct node *);
struct node * insert1(int,int);
void insertdisplay(struct node *);
void mulpoly(struct node *,struct node *);
struct node * i... |
C | #ifndef TERM_H_INCLUDED
#define TERM_H_INCLUDED
#include <termios.h>
/*
* Get the original terminal mode, set TCSANOW for the new one and
* register reset_terminal_mode() for program exit.
*/
void nonblock();
/*
* Use the original terminal mode to reset the terminal on program
* exit.
*/
void reset_terminal_mo... |
C | /* Christopher Bachelor
** cbachelor@ucla.edu
** UCLA ID: 004608570
** FOR LAB 2B */
#include <stdio.h>
#include <getopt.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include "SortedList.h"
#include <time.h>
#include <pthread.h>
#include <string.h>
#include <signal.h>
/*Globals used in the program*/
... |
C | /*
Copyright (C) 2015 copyright holder
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
/*Escribe un programa que calcule la factorial de n, donde n es un numero entero ma-
yor o igual a 0 dado por el usuario.*/
int ft, num=0, h=1;
printf("ingrese un numero: ");
scanf("%d",&ft);
while(ft>0)
{
num=num+1;
h=h*num;
... |
C | /**
206
Reverse a singly linked list.
Example:
Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULL
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode* reverseList(struct ListNode* head){
typedef struct ListNode Node;
Node *p... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <time.h>
#include <errno.h>
#include <semaphore.h>
#include "buffer.h"
/*
This method takes in a buffer and initializes its variable values
*/
void createBuffer(Buffer* buff)
{
buff -> in = 0; // set th... |
C | #include<stdio.h>
int main()
{
int x,c=0;
printf("enter the number\n");
scanf("%d",&x);
/* while(x)
{
if(x & 0x01)
c++;
x=x>>1;
}
printf("number of 1's:%d\n",c);
if(c==1)
printf("number is power of 2\n");
else printf("number is not power of 2\n");
}
*/
/* in above programm loop is con... |
C | #include<stdio.h>
void main()
{
int n,i,sum=0;
{
printf("Enter a number: ");
scanf("%d",&n);
}
{
for(i=1;i<=n;i++)
{
sum +=i;// sum = sum+i;
}
{
printf("Sum = %d",sum);
}
return 0;
}
|
C | #include "system_queue.h"
static SystemQueue s_queue;
void SystemQueueInit() {
s_queue.n = 0;
}
size_t SizeSystemQueue() {
return s_queue.n;
}
int EnqueueSystemQueue(const PEvent event) {
int ret = 0;
if(s_queue.n <= MAX_EVENTS) {
Event_clone(OBJECT(event), OBJECT(&s_queue.system_events[s_qu... |
C | #include <arpa/inet.h> /* for sockaddr_in and inet_ntoa() */
#include <fcntl.h>
#include <stdio.h> /* for printf() and fprintf() */
#include <stdlib.h> /* for atoi() and exit() */
#include <string.h> /* for memset() */
#include <sys/ioctl.h>
#include <sys/socket.h> /* for socket(), bind(), and connect() */
#include <s... |
C | // tcpcli01.c
#include "unp.h"
int main(int argc, char *argv[]){
if(argc!=2){
fprintf(stderr, "Usage: %s <IP>\n", argv[0]); exit(1);
}
int sockfd = Socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in servsock;
char buf[MAXLINE];
bzero(&servsock, sizeof(servsock));
servsock.sin_famil... |
C | /******************************************************************************
* Copyright 2020 The Firmament Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License ... |
C | #include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
void *thread_function(void *data)
{
//pid_t pid;
//pthread_t tid;
//pid = getpid();
//tid = pthread_self();
//char* thread_name = (char*)data;
int i = 0;
while (i < 5)
{
printf("%s, count %d\n", (char*)data, i);
i++;
sleep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.